GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — [PEP 741] gh-107954: Add PyInitConfig C API by vstinner · Pull Request #110176 · python/cpython Conversation
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
4bee604 to
2b5a76c
Compare
|
TODO: once we reach an consensus on the API, I will document the API. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
2b5a76c to
dd6c047
Compare
acdcb6c to
624cbcb
Compare
624cbcb to
e85efd1
Compare
|
I documented the API. I decided to add a new |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Now that I see all the docs, it looks the design is missing a function: https://discuss.python.org/t/fr-allow-private-runtime-config-to-enable-extending-without-breaking-the-pyconfig-abi/18004/49?u=encukou
I also have a few docs nitpicks. I didn't look very closely at the implementation yet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| Return ``-1`` if Python wants to exit and on error. Call | ||
| :c:func:`Py_ExitWithInitConfig` in this case. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What happens if you don't call it? (If it needs to be called, why does Py_InitializeFromInitConfig not call it itself?)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The idea is to let the caller decide how to handle an error or an exit code. When you embed Python, you may not want the process to exit. It's a similar design than Py_InitializeFromConfig() and the PyStatus C API.
What happens if you don't call it?
Python is in an undefined state. The error/exit code stays in PyInitConfig. It's safer to handle the init error :-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
fee8cc4 to
7d59519
Compare
|
This change is quite big, so I moved PyConfig_Get() API to a separated PR: PR #112609. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
7d59519 to
582a0c1
Compare
Add PyInitConfig functions: * PyInitConfig_Python_New() * PyInitConfig_Isolated_New() * PyInitConfig_Free(config) * PyInitConfig_SetInt(config, key, value) * PyInitConfig_SetStr(config, key, value) * PyInitConfig_SetWStr(config, key, value) * PyInitConfig_SetStrList(config, key, length, items) * PyInitConfig_SetWStrList(config, key, length, items) * PyInitConfig_Exception(config) * PyInitConfig_GetError(config, &err_msg) * PyInitConfig_GetExitCode(config, &exitcode) Add also functions using it: * Py_InitializeFromInitConfig(config) * Py_ExitWithInitConfig(config) Add these functions to the limited C API. Changes: * Add Doc/c-api/config.rst. * Add Include/initconfig.h header.
582a0c1 to
6d02e9e
Compare
|
This API is kind of complicated (there are multiple use cases). I created PR #112609 as a starting point, just to add two functions. But apparently, adding PyConfig_Get() and PyConfig_GetInt() functions is more complicated than what I expected. I don't have the bandwidth to deal with such large API for now, so I prefer to close the PR. See also my comment on the PyConfig_Get() PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
New PR: #123502 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.