Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: py3.5
Changeset: r95174:f4bc915225bc
Date: 2018-10-01 15:41 +0100
http://bitbucket.org/pypy/pypy/changeset/f4bc915225bc/

Log:    Resync boolobject.h with CPython, rename _Py_ZeroStruct to
        _Py_FalseStruct

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -668,7 +668,7 @@
     'PyObject*', 'space.w_None', header=pypy_decl)
 register_global('_Py_TrueStruct',
     'PyObject*', 'space.w_True', header=pypy_decl)
-register_global('_Py_ZeroStruct',
+register_global('_Py_FalseStruct',
     'PyObject*', 'space.w_False', header=pypy_decl)
 register_global('_Py_NotImplementedStruct',
     'PyObject*', 'space.w_NotImplemented', header=pypy_decl)
diff --git a/pypy/module/cpyext/include/boolobject.h 
b/pypy/module/cpyext/include/boolobject.h
--- a/pypy/module/cpyext/include/boolobject.h
+++ b/pypy/module/cpyext/include/boolobject.h
@@ -1,5 +1,4 @@
-
-/* Bool object interface */
+/* Boolean object interface */
 
 #ifndef Py_BOOLOBJECT_H
 #define Py_BOOLOBJECT_H
@@ -7,15 +6,19 @@
 extern "C" {
 #endif
 
-#define Py_False ((PyObject *) &_Py_ZeroStruct)
+#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type)
+
+/* Py_False and Py_True are the only two bools in existence.
+Don't forget to apply Py_INCREF() when returning either!!! */
+
+/* Use these macros */
+#define Py_False ((PyObject *) &_Py_FalseStruct)
 #define Py_True ((PyObject *) &_Py_TrueStruct)
 
 /* Macros for returning Py_True or Py_False, respectively */
 #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
 #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
 
-#define PyBool_Check(op) ((op)->ob_type == &PyBool_Type)
-
 #ifdef __cplusplus
 }
 #endif
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to