A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/python/cpython/commit/4bb2a1ebc569eee6f1b46ecef1965a26ae8cb76d below:

Convert PyObject_TypeCheck to static inline function (GH-2… · python/cpython@4bb2a1e · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+9

-4

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+9

-4

lines changed Original file line number Diff line number Diff line change

@@ -297,8 +297,8 @@ Object Protocol

297 297 298 298

.. c:function:: int PyObject_TypeCheck(PyObject *o, PyTypeObject *type)

299 299 300 -

Return true if the object *o* is of type *type* or a subtype of *type*. Both

301 -

parameters must be non-``NULL``.

300 +

Return non-zero if the object *o* is of type *type* or a subtype of *type*, and

301 +

``0`` otherwise. Both parameters must be non-``NULL``.

302 302 303 303 304 304

.. c:function:: Py_ssize_t PyObject_Size(PyObject *o)

Original file line number Diff line number Diff line change

@@ -235,8 +235,11 @@ PyAPI_FUNC(void *) PyType_GetModuleState(struct _typeobject *);

235 235 236 236

/* Generic type check */

237 237

PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *);

238 -

#define PyObject_TypeCheck(ob, tp) \

239 -

(Py_IS_TYPE(ob, tp) || PyType_IsSubtype(Py_TYPE(ob), (tp)))

238 + 239 +

static inline int _PyObject_TypeCheck(PyObject *ob, PyTypeObject *type) {

240 +

return Py_IS_TYPE(ob, type) || PyType_IsSubtype(Py_TYPE(ob), type);

241 +

}

242 +

#define PyObject_TypeCheck(ob, type) _PyObject_TypeCheck(_PyObject_CAST(ob), type)

240 243 241 244

PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */

242 245

PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */

Original file line number Diff line number Diff line change

@@ -0,0 +1,2 @@

1 +

Convert :c:func:`PyObject_TypeCheck` macro to a static inline function. Patch by

2 +

Erlend E. Aasland.

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4