From 675e1885beaacc819b3464961d2eb5651f1823b2 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 19 Jan 2025 22:39:07 +0100 Subject: [PATCH] Optimize PyWeakref_GetRef() --- pythoncapi_compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythoncapi_compat.h b/pythoncapi_compat.h index 0ea8e80..c533b82 100644 --- a/pythoncapi_compat.h +++ b/pythoncapi_compat.h @@ -583,7 +583,7 @@ static inline int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) return 0; } *pobj = Py_NewRef(obj); - return (*pobj != NULL); + return 1; } #endif