[New-bugs-announce] [issue32096] Py_DecodeLocale() fails if used before the runtime is initialized.

Eric Snow report at bugs.python.org
Mon Nov 20 16:28:36 EST 2017


New submission from Eric Snow <ericsnowcurrently at 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 <report at bugs.python.org>
<https://bugs.python.org/issue32096>
_______________________________________


More information about the New-bugs-announce mailing list