gh-118789: Restore hidden _PyWeakref_ClearRef
(#118797)
_PyWeakref_ClearRef was previously exposed in the public C-API, although it begins with an underscore and is not documented. It's used by a few C-API extensions. There is currently no alternative public API that can replace its use. _PyWeakref_ClearWeakRefsExceptCallbacks is the only thread-safe way to use _PyWeakref_ClearRef in the free-threaded build. This exposes the C symbol, but does not make the API public.
This commit is contained in:
parent
a895756aec
commit
db5af7da09
@ -40,6 +40,8 @@ struct _PyWeakReference {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
|
||||||
|
|
||||||
Py_DEPRECATED(3.13) static inline PyObject* PyWeakref_GET_OBJECT(PyObject *ref_obj)
|
Py_DEPRECATED(3.13) static inline PyObject* PyWeakref_GET_OBJECT(PyObject *ref_obj)
|
||||||
{
|
{
|
||||||
PyWeakReference *ref;
|
PyWeakReference *ref;
|
||||||
|
@ -111,8 +111,6 @@ extern Py_ssize_t _PyWeakref_GetWeakrefCount(PyObject *obj);
|
|||||||
// intact.
|
// intact.
|
||||||
extern void _PyWeakref_ClearWeakRefsExceptCallbacks(PyObject *obj);
|
extern void _PyWeakref_ClearWeakRefsExceptCallbacks(PyObject *obj);
|
||||||
|
|
||||||
extern void _PyWeakref_ClearRef(PyWeakReference *self);
|
|
||||||
|
|
||||||
PyAPI_FUNC(int) _PyWeakref_IsDead(PyObject *weakref);
|
PyAPI_FUNC(int) _PyWeakref_IsDead(PyObject *weakref);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
Restore ``_PyWeakref_ClearRef`` that was previously removed in Python 3.13
|
||||||
|
alpha 1.
|
Loading…
x
Reference in New Issue
Block a user