summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 9d51c8a..da17bfe 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -451,6 +451,12 @@ unicode_check_encoding_errors(const char *encoding, const char *errors)
return 0;
}
+ /* Disable checks during Python finalization. For example, it allows to
+ call _PyObject_Dump() during finalization for debugging purpose. */
+ if (interp->finalizing) {
+ return 0;
+ }
+
if (encoding != NULL) {
PyObject *handler = _PyCodec_Lookup(encoding);
if (handler == NULL) {