Skip to content

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Aug 23, 2018

bpo-34170, bpo-34207: Fix pymain_init_cmdline_argv()

  • Add _Py_DecodeUTF8()
  • pymain_init_cmdline_argv() now calls directly _Py_DecodeUTF8() if
    the UTF-8 mode is enabled

Previously, pymain_init_cmdline_argv() always called
Py_DecodeLocale() which depends on Py_UTF8Mode, whereas this variable
is no longer modified when reading the current configuration.

bpo-34170, bpo-34207: Fix pymain_init_cmdline_argv()

* Add _Py_DecodeUTF8()
* pymain_init_cmdline_argv() now calls directly _Py_DecodeUTF8() if
  the UTF-8 mode is enabled

Previously, pymain_init_cmdline_argv() always called
Py_DecodeLocale() which depends on Py_UTF8Mode, whereas this variable
is no longer modified when reading the current configuration.
@vstinner
Copy link
Member Author

I tested manually that this change fix test_cmd_line on FreeBSD when run in an empty environment:

vstinner@freebsd$ env -i ./python -m test test_cmd_line
Run tests sequentially
0:00:00 load avg: 0.41 [1/1] test_cmd_line

== Tests result: SUCCESS ==

1 test OK.

Total duration: 5 sec 600 ms
Tests result: SUCCESS

@vstinner
Copy link
Member Author

I'm not sure that this change is enough: _PyCoreConfig_Read() calls _PyCoreConfig_InitPathConfig() which later indirectly calls _Py_EncodeLocaleRaw() which also depends on Py_UTF8Mode.

@vstinner
Copy link
Member Author

Hum, this PR is incomplete because of Py_EncodeLocale() and similar functions. I wrote PR #8868 which is more generic and so safer.

@vstinner vstinner closed this Aug 23, 2018
@vstinner vstinner deleted the argv_utf8 branch August 23, 2018 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants