-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translate encoder error codes to strings; deprecate ImageFile.raise_oserror()
#7609
Conversation
7651a49
to
5426d7b
Compare
Should we switch all the internal callers to Alternatively, if we don't want to do that, should we expose the new |
That wouldn't completely simplify things though, would it? Because it is still ideal to raise the error raise _get_oserror(errcode, encoder=True) from exc which While Pillow values backwards compatibility, I agree that |
5426d7b
to
3bb5cf4
Compare
raise_oserror()
Sounds good, done. |
3bb5cf4
to
7ede4b5
Compare
When decoding, we use raise_oserror() to convert codec error codes to strings. Adapt that code to be used when encoding as well. Add a new helper function that returns the exception so we can still raise `from exc`.
7ede4b5
to
1df3158
Compare
1df3158
to
3db2e17
Compare
It's only useful if the caller has an IMAGING_CODEC_* error code, which are only produced by codec decode() methods and are automatically translated by ImageFile. Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
3db2e17
to
e1fb1ab
Compare
Added @radarhere's changes from bgilbert#4. |
raise_oserror()
ImageFile.raise_oserror()
When decoding, we use
raise_oserror()
to convert codec error codes to strings. Adapt that code to be used when encoding as well. Add a new helper function that returns the exception so we can still raisefrom exc
.Replace all callers of
raise_oserror()
withraise _get_oserror()
. Deprecateraise_oserror()
, since it doesn't need to be in the public API.Split out from #7553 (comment).