mirror of
https://github.com/python/cpython
synced 2026-09-29 11:55:30 +03:00
Issue #16991: Use PyObject_TypeCheck instead of PyObject_IsInstance.
This commit is contained in:
parent
7aa5341164
commit
8c7ed012b8
2 changed files with 4 additions and 4 deletions
|
|
@ -45,9 +45,9 @@ PyAPI_DATA(PyTypeObject) PyDictValues_Type;
|
|||
#define PyDict_Check(op) \
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
|
||||
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
|
||||
#define PyDictKeys_Check(op) (PyObject_IsInstance(op, (PyObject *)&PyDictKeys_Type))
|
||||
#define PyDictItems_Check(op) (PyObject_IsInstance(op, (PyObject *)&PyDictItems_Type))
|
||||
#define PyDictValues_Check(op) (PyObject_IsInstance(op, (PyObject *)&PyDictValues_Type))
|
||||
#define PyDictKeys_Check(op) PyObject_TypeCheck(op, &PyDictKeys_Type)
|
||||
#define PyDictItems_Check(op) PyObject_TypeCheck(op, &PyDictItems_Type)
|
||||
#define PyDictValues_Check(op) PyObject_TypeCheck(op, &PyDictValues_Type)
|
||||
/* This excludes Values, since they are not sets. */
|
||||
# define PyDictViewSet_Check(op) \
|
||||
(PyDictKeys_Check(op) || PyDictItems_Check(op))
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ PyAPI_DATA(PyTypeObject) PyODictValues_Type;
|
|||
|
||||
#endif /* Py_LIMITED_API */
|
||||
|
||||
#define PyODict_Check(op) PyObject_IsInstance(op, (PyObject *)&PyODict_Type)
|
||||
#define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type)
|
||||
#define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type)
|
||||
#define PyODict_SIZE(op) ((PyDictObject *)op)->ma_used
|
||||
#define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue