Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

C API: Remove PyEval_AcquireLock() and PyEval_InitThreads() functions #105182

Closed
Labels
@vstinner

Description

@vstinner

Since 3.7,PyEval_ThreadsInitialized() always returns non-zero and callingPyEval_InitThreads() is useless:Py_Initialize() now always creates the GIL. These functions were deprecated in Python 3.9 by PR#18892 (commitb4698ec) of issue#84058. What's New in Python 3.9:

* The :c:func:`PyEval_InitThreads` and :c:func:`PyEval_ThreadsInitialized`  functions are now deprecated and will be removed in Python 3.11. Calling  :c:func:`PyEval_InitThreads` now does nothing. The :term:`GIL` is initialized  by :c:func:`Py_Initialize()` since Python 3.7.  (Contributed by Victor Stinner in :issue:`39877`.)

Well, the removal missed Python 3.11.

PyEval_AcquireLock() andPyEval_ReleaseLock() don't update the current thread state and were deprecated in Python 3.2 by issue#55122:

These two functions are very low-level and no good to use outside the interpreter core (actually, inside the core I don't think they are useful either). We should deprecate them and recommend the thread-state aware functions instead. See issue#44960 for an example confusion.

The commitebeb903 adds this entry to What's New in Python 3.2:

* The misleading functions :c:func:`PyEval_AcquireLock()` and  :c:func:`PyEval_ReleaseLock()` have been officially deprecated.  The  thread-state aware APIs (such as :c:func:`PyEval_SaveThread()`  and :c:func:`PyEval_RestoreThread()`) should be used instead.

I propose to now removed these 4 deprecated functions.

In 2020, I already proposed to remove PyEval_AcquireLock() and PyEval_ReleaseLock() functions inhttps://bugs.python.org/issue39998 But I closed my issue when I discovered that they were part of the stable ABI. This is way to keep these functions in the stable ABI and remove them in the C API.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp