-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
gh-124665: add _PyCodec_UnregisterError
and _codecs._unregister_error
#124677
gh-124665: add _PyCodec_UnregisterError
and _codecs._unregister_error
#124677
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we should start with a public function. I would prefer to start with a private function instead, it's simpler.
@vstinner I followed your advice and only introduced the new array. We'll just need to keep in mind that if we add a new policy, then we should also add it to the array and test it. |
PyCodec_UnregisterError
and codecs.unregister_error
_PyCodec_UnregisterError
and _codecs._unregister_error
Include/internal/pycore_codecs.h
Outdated
@@ -21,6 +21,17 @@ extern void _PyCodec_Fini(PyInterpreterState *interp); | |||
|
|||
extern PyObject* _PyCodec_Lookup(const char *encoding); | |||
|
|||
/* | |||
* Un-register the error handling callback function error under the given | |||
* name. Only non-built-in error handlers can be un-registered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below you use "custom". Maybe it's better name than "non-built-in". I don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reworded the docs. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Merged, thank you. |
_PyCodec_UnregisterError
to un-register custom error handlers #124665📚 Documentation preview 📚: https://cpython-previews--124677.org.readthedocs.build/