[binutils-gdb] [gdb/python] Undefine Py_RETURN_{NONE, TRUE, FALSE, NOTIMPLEMENTED}

Tom de Vries via Gdb-cvs <[email protected]> Fri, 15 May 2026 19:38:40 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e6a1fc06d70e6398759042114bf17e4d02dac667

commit e6a1fc06d70e6398759042114bf17e4d02dac667
Author: Tom de Vries <[email protected]>
Date:   Fri May 15 21:38:12 2026 +0200

    [gdb/python] Undefine Py_RETURN_{NONE,TRUE,FALSE,NOTIMPLEMENTED}
    
    Now that we've removed all uses of Py_RETURN_{NONE,TRUE,FALSE,NOTIMPLEMENTED},
    undefine them to enforce using the refcount-safe wrappers instead.
    
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/python/python-internal.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 5548c456af9..693829e920d 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -1374,4 +1374,12 @@ py_notimplemented ()
   return gdbpy_ref<> (f ());
 }
 
+/* Undefine these to enforce using the refcount-safe wrappers py_none, py_true,
+   py_false and py_notimplemented.  */
+
+#undef Py_RETURN_NONE
+#undef Py_RETURN_TRUE
+#undef Py_RETURN_FALSE
+#undef Py_RETURN_NOTIMPLEMENTED
+
 #endif /* GDB_PYTHON_PYTHON_INTERNAL_H */