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, mariofutire, ncoghlan, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2018-10-06.14:42:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538836937.55.0.545547206417.issue34725@psf.upfronthosting.co.za>
In-reply-to
Content
Directly addressing the topic of the bug:

Py_SetProgramName() should be a relative or absolute path that can be used to set sys.executable and other values appropriately. This is used in Programs/_testembed.c for example.

I didn't know it didn't work the same way on Windows as it does on other platforms, and I have no idea why it's different there. (The divergence between the Windows and *nix implementations of getpath predates my own involvement in startup sequence modifications, and I've never even read the Windows version of the code)

On the startup sequence refactoring in general:

Yeah, eventually being able to eliminate getpath.c in favour of a froze _getpath.py module has been one of my long term hopes for the PEP 432 startup sequence refactoring. The underlying issue making that difficult that is that it's always been murky as to exactly what Python code could safely execute at the point where that path information needs to be calculated, and the tests of path configuration are weak enough that it's easy to introduce regressions even with small changes, let alone a wholesale rewrite.


If a new setting is genuinely needed, then where to put things in the new config is still open for discussion - at the moment, it's pretty much just a straight transcription of the way CPython has historically done things, and is hence heavy on the use of low level C data types (especially wchar* where paths are concerned).

This means that the CoreConfig struct currently still contains a lot of things that aren't actually needed if all you want is a running Python interpreter and can live without a fully populated sys module.

The *advantage* of that approach is that it means it still maps pretty easily to the existing Py_Initialize approach: the PySet_* API writes to a global copy of a the CoreConfig struct, and then Py_Initialize reads that in to the active runtime state.
History
Date User Action Args
2018-10-06 14:42:17ncoghlansetrecipients: + ncoghlan, paul.moore, vstinner, tim.golden, eric.snow, zach.ware, steve.dower, mariofutire
2018-10-06 14:42:17ncoghlansetmessageid: <1538836937.55.0.545547206417.issue34725@psf.upfronthosting.co.za>
2018-10-06 14:42:17ncoghlanlinkissue34725 messages
2018-10-06 14:42:17ncoghlancreate