Skip to content

Call _accept instead of duplicating code#4720

Merged
radarhere merged 2 commits into
python-pillow:masterfrom
radarhere:accept
Jun 23, 2020
Merged

Call _accept instead of duplicating code#4720
radarhere merged 2 commits into
python-pillow:masterfrom
radarhere:accept

Conversation

@radarhere

Copy link
Copy Markdown
Member

_open sometimes contains the same check as _accept. This PR changes some plugins to call _accept directly, instead of just duplicating the code.

This is already done by some other plugins. For example,

def _open(self):
offset = self.fp.tell()
# check magic
s = self.fp.read(6)
if not _accept(s):
raise SyntaxError("not a CUR file")

Comment thread src/PIL/BmpImagePlugin.py Outdated
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@radarhere
radarhere merged commit b667fd8 into python-pillow:master Jun 23, 2020
@radarhere
radarhere deleted the accept branch June 23, 2020 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants