]> granicus.if.org Git - python/commit
bpo-34523: Add _PyCoreConfig.filesystem_encoding (GH-8963)
authorVictor Stinner <vstinner@redhat.com>
Wed, 29 Aug 2018 11:25:36 +0000 (13:25 +0200)
committerGitHub <noreply@github.com>
Wed, 29 Aug 2018 11:25:36 +0000 (13:25 +0200)
commitb2457efc78b74a1d6d1b77d11a939e886b8a4e2c
treeb715b8061d730f07584d13e4475660d61fd261f5
parentdfe0dc74536dfb6f331131d9b2b49557675bb6b7
bpo-34523: Add _PyCoreConfig.filesystem_encoding (GH-8963)

_PyCoreConfig_Read() is now responsible to choose the filesystem
encoding and error handler. Using Py_Main(), the encoding is now
chosen even before calling Py_Initialize().

_PyCoreConfig.filesystem_encoding is now the reference, instead of
Py_FileSystemDefaultEncoding, for the Python filesystem encoding.

Changes:

* Add filesystem_encoding and filesystem_errors to _PyCoreConfig
* _PyCoreConfig_Read() now reads the locale encoding for the file
  system encoding.
* PyUnicode_EncodeFSDefault() and PyUnicode_DecodeFSDefaultAndSize()
  now use the interpreter configuration rather than
  Py_FileSystemDefaultEncoding and Py_FileSystemDefaultEncodeErrors
  global configuration variables.
* Add _Py_SetFileSystemEncoding() and _Py_ClearFileSystemEncoding()
  private functions to only modify Py_FileSystemDefaultEncoding and
  Py_FileSystemDefaultEncodeErrors in coreconfig.c.
* _Py_CoerceLegacyLocale() now takes an int rather than
  _PyCoreConfig for the warning.
12 files changed:
Include/coreconfig.h
Include/pylifecycle.h
Lib/test/test_embed.py
Lib/test/test_sys.py
Misc/NEWS.d/next/Core and Builtins/2018-08-28-01-45-01.bpo-34523.aUUkc3.rst [new file with mode: 0644]
Modules/main.c
Objects/unicodeobject.c
Programs/_freeze_importlib.c
Programs/_testembed.c
Python/coreconfig.c
Python/pylifecycle.c
Python/sysmodule.c