Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

codecs.open doesn't support encoding='locale' in Python3.11 #120406

Open
Labels
@Amethiel

Description

@Amethiel

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

No one assigned

    Labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp