File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,10 @@ Core and builtins
8989Extension modules
9090-----------------
9191
92+ - operator.isNumberType() now checks that the object has a nb_int or
93+ nb_float slot, rather than simply checking whether it has a non-NULL
94+ tp_as_number pointer.
95+
9296- The imp module now has ways to acquire and release the "import
9397 lock": imp.acquire_lock() and imp.release_lock(). Note: this is a
9498 reentrant lock, so releasing the lock only truly releases it when
@@ -318,6 +322,10 @@ Build
318322C API
319323-----
320324
325+ - PyNumber_Check() now checks that the object has a nb_int or nb_float
326+ slot, rather than simply checking whether it has a non-NULL
327+ tp_as_number pointer.
328+
321329- A C type that inherits from a base type that defines tp_as_buffer
322330 will now inherit the tp_as_buffer pointer if it doesn't define one.
323331 (SF #681367)
Original file line number Diff line number Diff line change @@ -308,7 +308,9 @@ int PyObject_AsWriteBuffer(PyObject *obj,
308308int
309309PyNumber_Check (PyObject * o )
310310{
311- return o && o -> ob_type -> tp_as_number ;
311+ return o && o -> ob_type -> tp_as_number &&
312+ (o -> ob_type -> tp_as_number -> nb_int ||
313+ o -> ob_type -> tp_as_number -> nb_float );
312314}
313315
314316/* Binary operators */
You can’t perform that action at this time.
0 commit comments