This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients eric.snow, htgoebel, ncoghlan, vstinner
Date 2018-03-12.14:02:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1520863354.29.0.467229070634.issue33042@psf.upfronthosting.co.za>
In-reply-to
Content
Adding a bit of context from my prior email discussion with Hartmut: CPython actually reads sys.warnoptions at the end of Py_Initialize (its the last thing we do before the function returns).

It also reads sys._xoptions during startup, since that's one way of enabling settings like dev mode and UTF-8 mode.

That means that even though PySys_AddWarnOption and PySys_AddXOption weren't documented as being safe to call before Py_Initialize, they likely *won't* have the desired effect if an embedding application defers calling them until later, and their absence from the list of "safe to call before Py_Initialize" functions was itself a documentation bug.

For 3.8, I'd hoped that the resolution might be as simple as a hard requirement on embedding applications to call PyRuntime_Initialize() before doing *anything* with the C API, but including the "internal/pystate.h" header and adding a call to _PyRuntime_Initialize() wasn't enough to keep the draft test case in my patch from segfaulting :(
History
Date User Action Args
2018-03-12 14:02:34ncoghlansetrecipients: + ncoghlan, htgoebel, vstinner, eric.snow
2018-03-12 14:02:34ncoghlansetmessageid: <1520863354.29.0.467229070634.issue33042@psf.upfronthosting.co.za>
2018-03-12 14:02:34ncoghlanlinkissue33042 messages
2018-03-12 14:02:34ncoghlancreate