Skip to content

Commit f268e32

Browse files
authored
gh-116738: Make _abc module thread-safe (#117488)
A collection of small changes aimed at making the `_abc` module safe to use in a free-threaded build.
1 parent 1b10efa commit f268e32

File tree

3 files changed

+205
-115
lines changed

3 files changed

+205
-115
lines changed

Include/internal/pycore_typeobject.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,18 @@ PyAPI_FUNC(PyObject*) _PySuper_Lookup(PyTypeObject *su_type, PyObject *su_obj,
152152

153153
extern PyObject* _PyType_GetFullyQualifiedName(PyTypeObject *type, char sep);
154154

155+
// Perform the following operation, in a thread-safe way when required by the
156+
// build mode.
157+
//
158+
// self->tp_flags = (self->tp_flags & ~mask) | flags;
159+
extern void _PyType_SetFlags(PyTypeObject *self, unsigned long mask,
160+
unsigned long flags);
161+
162+
// Like _PyType_SetFlags(), but apply the operation to self and any of its
163+
// subclasses without Py_TPFLAGS_IMMUTABLETYPE set.
164+
extern void _PyType_SetFlagsRecursive(PyTypeObject *self, unsigned long mask,
165+
unsigned long flags);
166+
155167

156168
#ifdef __cplusplus
157169
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy