Issue #19543: Emit deprecation warning for known non-text encodings.
Backported issues #19619: encode() and decode() methods and constructors
of str, unicode and bytearray classes now emit deprecation warning for known
non-text encodings when Python is ran with the -3 option.
Backported issues #20404: io.TextIOWrapper (and hence io.open()) now uses the
internal codec marking system added to emit deprecation warning for known non-text
encodings at stream construction time when Python is ran with the -3 option.
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 46f46db..c1e12a7 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -449,7 +449,7 @@
}
/* Decode via the codec registry */
- v = PyCodec_Decode(str, encoding, errors);
+ v = _PyCodec_DecodeText(str, encoding, errors);
if (v == NULL)
goto onError;
@@ -529,7 +529,7 @@
}
/* Encode via the codec registry */
- v = PyCodec_Encode(str, encoding, errors);
+ v = _PyCodec_EncodeText(str, encoding, errors);
if (v == NULL)
goto onError;