New submission from Eric Snow <ericsnowcurren...@gmail.com>:

(see the python-dev thread [1])
(related: issue #32086)

When I consolidated the global runtime state into a single global, _PyRuntime, 
calls Py_DecodeLocale() started to break if the runtime hadn't been intialized 
yet.  This is because that function relies on PyMem_RawMalloc() and 
PyMem_RawFree(), which rely on the raw allocator having been initialized as 
part of the runtime (it used to be intialized statically).

The documentation for various "Process-wide parameters" [2] explicitly directs 
users to call Py_DecodeLocale() where necessary.  The docs for 
Py_DecodeLocale(), in turn, explicitly refer to calling PyMem_RawFree().  So 
changing the pre-runtime-init behavior of Py_DecodeLocale() and PyMem_RawFree() 
is a regression that should be fixed.

[1] https://mail.python.org/pipermail/python-dev/2017-November/150605.html
[2] https://docs.python.org/3/c-api/init.html#process-wide-parameters

----------
assignee: eric.snow
messages: 306585
nosy: eric.snow, ncoghlan, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Py_DecodeLocale() fails if used before the runtime is initialized.
type: crash

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32096>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to