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

Appearance settings

Commit bb5bf24

Browse filesBrowse files
[3.13] gh-118789: Restore hidden _PyWeakref_ClearRef (GH-118797) (GH-118903)
gh-118789: Restore hidden `_PyWeakref_ClearRef` (GH-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. (cherry picked from commit db5af7d) Co-authored-by: Sam Gross <colesbury@gmail.com>
1 parent 93fce2d commit bb5bf24
Copy full SHA for bb5bf24

File tree

3 files changed

+4
-2
lines changed
Filter options

3 files changed

+4
-2
lines changed

‎Include/cpython/weakrefobject.h

Copy file name to clipboardExpand all lines: Include/cpython/weakrefobject.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ struct _PyWeakReference {
4040
#endif
4141
};
4242

43+
PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self);
44+
4345
Py_DEPRECATED(3.13) static inline PyObject* PyWeakref_GET_OBJECT(PyObject *ref_obj)
4446
{
4547
PyWeakReference *ref;

‎Include/internal/pycore_weakref.h

Copy file name to clipboardExpand all lines: Include/internal/pycore_weakref.h
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ extern Py_ssize_t _PyWeakref_GetWeakrefCount(PyObject *obj);
111111
// intact.
112112
extern void _PyWeakref_ClearWeakRefsExceptCallbacks(PyObject *obj);
113113

114-
extern void _PyWeakref_ClearRef(PyWeakReference *self);
115-
116114
PyAPI_FUNC(int) _PyWeakref_IsDead(PyObject *weakref);
117115

118116
#ifdef __cplusplus
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Restore ``_PyWeakref_ClearRef`` that was previously removed in Python 3.13
2+
alpha 1.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.