Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Open
Description
Bug report
Bug description:
from 3.10, io.text_encoding may return 'locale' if encoding is None, and the function open can support it well, like:
>>>open('/dev/null',encoding=io.text_encoding(None))<_io.TextIOWrappername='/dev/null'mode='r'encoding='UTF-8'>
but codes.open raised an error when i was doing this:
>>>codecs.open('/dev/null',encoding=io.text_encoding(None))Traceback (mostrecentcalllast):File"<stdin>",line1,in<module>File"<frozen codecs>",line910,inopenLookupError:unknownencoding:locale>>>codecs.open('/dev/null',encoding='locale')Traceback (mostrecentcalllast):File"<stdin>",line1,in<module>File"<frozen codecs>",line910,inopenLookupError:unknownencoding:locale
and codes.open can deal None correctly:
>>>codecs.open('/dev/null',encoding=None)<_io.TextIOWrappername='/dev/null'mode='r'encoding='UTF-8'>
My Python version is:
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
CPython versions tested on:
3.11
Operating systems tested on:
Linux, Windows
Metadata
Metadata
Assignees
Labels
Projects
Status
No status