You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
C API: Clarify which C functions are safe to be called before Py_Initialize() #76267
bpo-32096: Py_DecodeLocale() fails if used before the runtime is initialized.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2017-11-21.15:49:51.916>created_at=<Date2017-11-20.14:21:16.388>labels= ['interpreter-core', '3.7', 'release-blocker']
title='C API: Clarify which C functions are safe to be called before Py_Initialize()'updated_at=<Date2017-11-21.15:49:51.914>user='https://github.com/vstinner'
bpo-32096 covers reverting the change to PyDecode_Locale specifically for 3.7.
We can use this issue to ask the broader question "Do we want to *deprecate* our previously implied support for calling PyDecode_Locale() before Py_Initialize()?"
If the answer is "Yes", then we need to design a transition plan to a different API for setting config parameters that accept "wchar_t *".
If the answer is "No", then we need to document that design constraint on the affected APIs.
Either way, we should also improve the way we communicate the list of C API methods that can be safely called before Py_Initialize.
Is there a *need* to break existing code? What is the benefit and how large it in comparison with the necessary of rewriting every code that embeds Python (and supporting both ways for long time)?
Activity
vstinner commentedon Nov 20, 2017
See the python-dev thread:
https://mail.python.org/pipermail/python-dev/2017-November/150605.html
AraHaan commentedon Nov 20, 2017
For me, it looks like Py_DecodeLocal() is still safe (according to python 3.6.3 unless anything changed in it).
vstinner commentedon Nov 20, 2017
This issue is a regression in Python 3.7.
AraHaan commentedon Nov 20, 2017
Ah, I see now.
ncoghlan commentedon Nov 21, 2017
bpo-32096 covers reverting the change to PyDecode_Locale specifically for 3.7.
We can use this issue to ask the broader question "Do we want to *deprecate* our previously implied support for calling PyDecode_Locale() before Py_Initialize()?"
If the answer is "Yes", then we need to design a transition plan to a different API for setting config parameters that accept "wchar_t *".
If the answer is "No", then we need to document that design constraint on the affected APIs.
Either way, we should also improve the way we communicate the list of C API methods that can be safely called before Py_Initialize.
serhiy-storchaka commentedon Nov 21, 2017
Is there a *need* to break existing code? What is the benefit and how large it in comparison with the necessary of rewriting every code that embeds Python (and supporting both ways for long time)?
vstinner commentedon Nov 21, 2017
I mark this issue as a duplicate of bpo-32096.