classification
Title: C API: Clarify which C functions are safe to be called before Py_Initialize()
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Py_DecodeLocale() fails if used before the runtime is initialized.
View: 32096
Assigned To: Nosy List: Decorater, eric.snow, ncoghlan, ned.deily, serhiy.storchaka, vstinner
Priority: release blocker Keywords:

Created on 2017-11-20 14:21 by vstinner, last changed 2017-11-21 15:49 by vstinner. This issue is now closed.

Messages (7)
msg306544 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-20 14:21
See the python-dev thread:
https://mail.python.org/pipermail/python-dev/2017-November/150605.html
msg306588 - (view) Author: Decorater (Decorater) * Date: 2017-11-20 21:46
For me, it looks like Py_DecodeLocal() is still safe (according to python 3.6.3 unless anything changed in it).
msg306589 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-20 21:46
> For me, it looks like Py_DecodeLocal() is still safe (according to python 3.6.3 unless anything changed in it).

This issue is a regression in Python 3.7.
msg306590 - (view) Author: Decorater (Decorater) * Date: 2017-11-20 21:49
Ah, I see now.
msg306615 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-11-21 02:06
Issue 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.
msg306632 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-11-21 07:35
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)?
msg306657 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-21 15:49
I mark this issue as a duplicate of bpo-32096.
History
Date User Action Args
2017-11-21 15:50:27vstinnerunlinkissue32096 superseder
2017-11-21 15:49:51vstinnersetstatus: open -> closed
superseder: Py_DecodeLocale() fails if used before the runtime is initialized.
messages: + msg306657

resolution: duplicate
stage: resolved
2017-11-21 07:35:15serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg306632
2017-11-21 02:06:06ncoghlansetnosy: + ncoghlan
messages: + msg306615
2017-11-20 22:06:33vstinnerlinkissue32096 superseder
2017-11-20 21:49:26Decoratersetmessages: + msg306590
2017-11-20 21:46:59vstinnersetmessages: + msg306589
2017-11-20 21:46:07Decoratersetnosy: + Decorater
messages: + msg306588
2017-11-20 16:09:53serhiy.storchakasetpriority: normal -> release blocker
nosy: + ned.deily
2017-11-20 15:54:17eric.snowsetnosy: + eric.snow
2017-11-20 14:21:16vstinnercreate