Skip to content
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

bpo-35713: Rework Python initialization #11647

Merged
merged 1 commit into from
Jan 22, 2019
Merged

bpo-35713: Rework Python initialization #11647

merged 1 commit into from
Jan 22, 2019

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jan 22, 2019

  • Remove PyByteArray_Init() and PyByteArray_Fini() functions, they
    did nothing since Python 2.7.4 and Python 3.2.0.
  • _PyExc_Init() now returns an error on failure rather than calling
    Py_FatalError(). Move macros inside _PyExc_Init() and undefine them
    when done. Rewrite macros to make them look more like statement:
    add ";" when using them, add "do { ... } while (0)".
  • _PyUnicode_Init() now returns a _PyInitError error rather than call
    Py_FatalError().
  • Move stdin check from _PySys_BeginInit() to init_sys_streams().
  • _Py_ReadyTypes() now returns a _PyInitError error rather than
    calling Py_FatalError().
  • Move "_PyXXX_Init()" and "_PyXXX_Fini()" declarations from
    Include/cpython/pylifecycle.h to
    Include/internal/pycore_pylifecycle.h. Replace
    "PyAPI_FUNC(TYPE)" with "extern TYPE".

https://bugs.python.org/issue35713

@vstinner
Copy link
Member Author

@scoder, @ericsnowcurrently: Do you think that it's ok to remove "PyXXX_Init()" from the C API? I don't see why anyone would call them explicitly?

@vstinner
Copy link
Member Author

@scoder, @ericsnowcurrently: Do you think that it's ok to remove "PyXXX_Init()" from the C API? I don't see why anyone would call them explicitly?

Ignore my questions. In fact, these functions are prefixed by "_Py": they are private, and we don't provide any stability warranty for the private API.

* The PyByteArray_Init() and PyByteArray_Fini() functions have been
  removed. They did nothing since Python 2.7.4 and Python 3.2.0, were
  excluded from the limited API (stable ABI), and were not
  documented.
* Move "_PyXXX_Init()" and "_PyXXX_Fini()" declarations from
  Include/cpython/pylifecycle.h to
  Include/internal/pycore_pylifecycle.h. Replace
  "PyAPI_FUNC(TYPE)" with "extern TYPE".
* _PyExc_Init() now returns an error on failure rather than calling
  Py_FatalError(). Move macros inside _PyExc_Init() and undefine them
  when done. Rewrite macros to make them look more like statement:
  add ";" when using them, add "do { ... } while (0)".
* _PyUnicode_Init() now returns a _PyInitError error rather than call
  Py_FatalError().
* Move stdin check from _PySys_BeginInit() to init_sys_streams().
* _Py_ReadyTypes() now returns a _PyInitError error rather than
  calling Py_FatalError().
@vstinner
Copy link
Member Author

I modified my PR to document properly the removal of PyByteArray_Init() and PyByteArray_Fini() functions: documented in the Porting section of What's New in Python 3.8 and in a NEWS entry.

@vstinner vstinner merged commit bf4ac2d into python:master Jan 22, 2019
@vstinner vstinner deleted the rework_init branch January 22, 2019 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants