Skip to content

[WIP] bpo-35265: Add _PyConfigCtx #10574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed

[WIP] bpo-35265: Add _PyConfigCtx #10574

wants to merge 12 commits into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Nov 16, 2018

  • Add _PyConfigCtx structure

  • Add "ctx" context (_PyConfigCtx) to _PyCoreConfig, _PyPathConfig,
    _Py_PreInit and PyCalculatePath.

  • Move _PyCoreConfig.utf8_mode into _PyConfigCtx

  • Replace _PyCoreConfig_INIT with _PyCoreConfig_Init()

  • Replace _PyPathConfig_INIT with _PyPathConfig_StaticInit()

  • Add new functions:

    • _PyMem_RawMallocCtx()
    • _PyMem_RawCallocCtx()
    • _PyMem_RawReallocCtx()
    • _PyMem_RawFreeCtx()
  • Add ctx paramter to functions:

    • _Py_DecodeLocaleEx()
    • _Py_EncodeLocaleEx()
    • _PyMem_RawWcsdup()
  • Use ctx in Python initialization code

https://bugs.python.org/issue35265

* Add _PyConfigCtx structure
* Add "ctx" context (_PyConfigCtx) to _PyCoreConfig, _PyPathConfig,
  _Py_PreInit and PyCalculatePath.
* Move _PyCoreConfig.utf8_mode into _PyConfigCtx
* Replace _PyCoreConfig_INIT with _PyCoreConfig_Init()
* Replace _PyPathConfig_INIT with _PyPathConfig_StaticInit()
* Add new functions:

  * _PyMem_RawMallocCtx()
  * _PyMem_RawCallocCtx()
  * _PyMem_RawReallocCtx()
  *  _PyMem_RawFreeCtx()

* Add ctx paramter to functions:

  * _Py_DecodeLocaleEx()
  * _Py_EncodeLocaleEx()
  * _PyMem_RawWcsdup()

* Use ctx in Python initialization code
@vstinner
Copy link
Member Author

"./python -m test -v test_cmd_line -m test_pythonmalloc" fails. There is very likely bugs somewhere in my change, but I mostly wrote this PR as proof-of-concept. It's not ready to be reviewed nor to be merged.

@vstinner
Copy link
Member Author

Honestly, I'm not convinced that the change is worth it. It looks like a giant complication for a very specific use case, whereas the current _PyMem_SetDefaultAllocator() solution "works". I close the PR.

@vstinner vstinner closed this Nov 22, 2018
@vstinner vstinner deleted the ctx branch November 22, 2018 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants