mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
gh-127271: Replace use of PyCell_GET/SET (gh-127272)
* Replace uses of `PyCell_GET` and `PyCell_SET`. These macros are not safe to use in the free-threaded build. Use `PyCell_GetRef()` and `PyCell_SetTakeRef()` instead. * Since `PyCell_GetRef()` returns a strong rather than borrowed ref, some code restructuring was required, e.g. `frame_get_var()` returns a strong ref now. * Add critical sections to `PyCell_GET` and `PyCell_SET`. * Move critical_section.h earlier in the Python.h file. * Add `PyCell_GET` to the free-threading howto table of APIs that return borrowed refs. * Add additional unit tests for free-threading.
This commit is contained in:
parent
276cd66ccb
commit
fc5a0dc224
8 changed files with 231 additions and 48 deletions
|
|
@ -69,6 +69,7 @@
|
|||
#include "pystats.h"
|
||||
#include "pyatomic.h"
|
||||
#include "lock.h"
|
||||
#include "critical_section.h"
|
||||
#include "object.h"
|
||||
#include "refcount.h"
|
||||
#include "objimpl.h"
|
||||
|
|
@ -130,7 +131,6 @@
|
|||
#include "import.h"
|
||||
#include "abstract.h"
|
||||
#include "bltinmodule.h"
|
||||
#include "critical_section.h"
|
||||
#include "cpython/pyctype.h"
|
||||
#include "pystrtod.h"
|
||||
#include "pystrcmp.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue