Skip to content

Commit 47971e9

Browse files
committed
add docs
1 parent a134f23 commit 47971e9

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Doc/c-api/codec.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,22 @@ Registry API for Unicode encoding error handlers
9797
9898
Return ``0`` on success, ``-1`` on error.
9999
100+
.. c:function:: int PyCodec_UnregisterError(const char *name)
101+
102+
Un-register the error handling callback function error under the given error
103+
policy *name*. :ref:`Standard error policies <serror-handlers>` cannot be
104+
un-registered.
105+
106+
* Return ``-1`` and set a :exc:`ValueError` exception if *name* is a
107+
standard error policy or if an error occurred (in which case the
108+
existing exception is propagated).
109+
110+
* Return ``0`` if no error handler is associated with the given error policy.
111+
112+
* Return ``1`` if the error handler was successfully removed.
113+
114+
.. versionadded:: 3.14
115+
100116
.. c:function:: PyObject* PyCodec_LookupError(const char *name)
101117
102118
Lookup the error handling callback function registered under *name*. As a

Doc/library/codecs.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,17 @@ handler:
439439
replacement from the error handler will be put into the output directly.
440440

441441

442+
.. function:: unregister_error(name)
443+
444+
Attempt to un-register the error handling function under the name *name*.
445+
446+
This raises a :exc:`ValueError` if *name* denotes a standard error policy
447+
as specified above. Otherwise, this returns ``True`` if an error handler
448+
existed for the given *name* and ``False`` otherwise.
449+
450+
.. versionadded:: 3.14
451+
452+
442453
Previously registered error handlers (including the standard error handlers)
443454
can be looked up by name:
444455

0 commit comments

Comments
 (0)