mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
gh-105927: Add _PyWeakref_IS_DEAD() function (#105992)
* Add _PyWeakref_IS_DEAD() internal function. * Modify is_dead_weakref() of Modules/_weakref.c and _pysqlite_drop_unused_cursor_references() to replace PyWeakref_GET_OBJECT() with _PyWeakref_IS_DEAD(). * Replace "int i" with "Py_ssize_t i" to iterate on cursors in _pysqlite_drop_unused_cursor_references().
This commit is contained in:
parent
d8f87cdf94
commit
c38da1e3e1
3 changed files with 30 additions and 14 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "Python.h"
|
||||
#include "pycore_object.h" // _PyObject_GET_WEAKREFS_LISTPTR
|
||||
#include "pycore_object.h" // _PyObject_GET_WEAKREFS_LISTPTR
|
||||
#include "pycore_weakref.h" // _PyWeakref_IS_DEAD()
|
||||
|
||||
|
||||
#define GET_WEAKREFS_LISTPTR(o) \
|
||||
|
@ -43,7 +44,7 @@ is_dead_weakref(PyObject *value)
|
|||
PyErr_SetString(PyExc_TypeError, "not a weakref");
|
||||
return -1;
|
||||
}
|
||||
return PyWeakref_GET_OBJECT(value) == Py_None;
|
||||
return _PyWeakref_IS_DEAD(value);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue