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

Recording and restoring the LC_NUMERIC locale setting with LC_ALL=C.UTF-8 no longer works with Python 3.13.3 #133967

Open
Labels
3.13bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error
@bouweandela

Description

@bouweandela

Bug report

Bug description:

We have project where we record the current value oflocale.LC_NUMERIC, change it to a different value to use a library that needs a particular locale setting, and then restore it to the original value. This stopped working with Python 3.13.3. I suspect this may be a bug, but please correct me if I misunderstood the functionality.

Example with Python 3.13.3:

$dockerrun-itpython:3.13.3Python3.13.3 (main,May92025,23:49:05) [GCC12.2.0]onlinuxType"help","copyright","credits"or"license"formoreinformation.>>>importos,locale>>>os.environenviron({'PATH':'/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin','HOSTNAME':'2e43b79a7135','TERM':'xterm','GPG_KEY':'7169605F62C751356D054A26A821E680E5FA6305','PYTHON_VERSION':'3.13.3','PYTHON_SHA256':'40f868bcbdeb8149a3149580bb9bfd407b3321cd48f0be631af955ac92c0e041','HOME':'/root','LC_CTYPE':'C.UTF-8'})>>>os.environ["LC_ALL"]="C.UTF-8">>>locale.setlocale(locale.LC_ALL,"")'C.UTF-8'>>>locale.getlocale(locale.LC_NUMERIC)('en_US','UTF-8')>>>locale.setlocale(locale.LC_NUMERIC,locale.getlocale(locale.LC_NUMERIC))Traceback (mostrecentcalllast):File"<python-input-5>",line1,in<module>locale.setlocale(locale.LC_NUMERIC,locale.getlocale(locale.LC_NUMERIC))~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/usr/local/lib/python3.13/locale.py",line615,insetlocalereturn_setlocale(category,locale)locale.Error:unsupportedlocalesetting

The same example works fine with earlier versions of Python, for example 3.13.2:

$dockerrun-itpython:3.13.2Python3.13.2 (main,Apr82025,04:27:11) [GCC12.2.0]onlinuxType"help","copyright","credits"or"license"formoreinformation.>>>importos,locale>>>os.environenviron({'PATH':'/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin','HOSTNAME':'64800af765e4','TERM':'xterm','GPG_KEY':'7169605F62C751356D054A26A821E680E5FA6305','PYTHON_VERSION':'3.13.2','PYTHON_SHA256':'d984bcc57cd67caab26f7def42e523b1c015bbc5dc07836cf4f0b63fa159eb56','HOME':'/root','LC_CTYPE':'C.UTF-8'})>>>os.environ["LC_ALL"]="C.UTF-8">>>locale.setlocale(locale.LC_ALL,"")'C.UTF-8'>>>locale.getlocale(locale.LC_NUMERIC)('C','UTF-8')>>>locale.setlocale(locale.LC_NUMERIC,locale.getlocale(locale.LC_NUMERIC))'C.UTF-8'

It looks like this may have been caused by the changes in#129647.

CPython versions tested on:

3.13

Operating systems tested on:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp