Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b60654b

Browse files
committed
The return value from PyObject_ClearWeakRefs() is no longer meaningful,
so make it void.
1 parent 4f9b13b commit b60654b

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

Include/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ extern DL_IMPORT(int) PyCallable_Check(PyObject *);
284284
extern DL_IMPORT(int) PyNumber_Coerce(PyObject **, PyObject **);
285285
extern DL_IMPORT(int) PyNumber_CoerceEx(PyObject **, PyObject **);
286286

287-
extern DL_IMPORT(int) (*PyObject_ClearWeakRefs)(PyObject *);
287+
extern DL_IMPORT(void) (*PyObject_ClearWeakRefs)(PyObject *);
288288

289289
/* Helpers for printing recursive container types */
290290
extern DL_IMPORT(int) Py_ReprEnter(PyObject *);

Modules/_weakref.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ weakref_proxy(PyObject *self, PyObject *args)
692692
* until one resurrects the object, at which point it stops invalidating
693693
* weak references and returns false.
694694
*/
695-
static int
695+
static
696696
cleanup_helper(PyObject *object)
697697
{
698698
PyWeakReference **list;
@@ -702,7 +702,7 @@ cleanup_helper(PyObject *object)
702702
|| object->ob_refcnt != 0) {
703703
PyErr_BadInternalCall();
704704
/* not sure what we should return here */
705-
return 1;
705+
return;
706706
}
707707
list = GET_WEAKREFS_LISTPTR(object);
708708
while (*list != NULL) {
@@ -722,7 +722,7 @@ cleanup_helper(PyObject *object)
722722
Py_DECREF(callback);
723723
}
724724
}
725-
return (object->ob_refcnt > 0 ? 0 : 1);
725+
return;
726726
}
727727

728728

Objects/classobject.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,7 @@ instance_dealloc(register PyInstanceObject *inst)
516516
extern long _Py_RefTotal;
517517
#endif
518518

519-
if (!PyObject_ClearWeakRefs((PyObject *) inst))
520-
return;
519+
PyObject_ClearWeakRefs((PyObject *) inst);
521520

522521
/* Temporarily resurrect the object. */
523522
#ifdef Py_TRACE_REFS

Objects/object.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,13 +1475,13 @@ PyObject_Free(void *p)
14751475
call site instead of requiring a test for NULL.
14761476
*/
14771477

1478-
static int
1478+
static void
14791479
empty_clear_weak_refs(PyObject *o)
14801480
{
1481-
return 1;
1481+
return;
14821482
}
14831483

1484-
int (*PyObject_ClearWeakRefs)(PyObject *) = empty_clear_weak_refs;
1484+
void (*PyObject_ClearWeakRefs)(PyObject *) = empty_clear_weak_refs;
14851485

14861486

14871487

0 commit comments

Comments
 (0)