[Python-checkins] cpython (3.5): Issue #16991: Use PyObject_TypeCheck instead of PyObject_IsInstance.
eric.snow
python-checkins at python.org
Sat May 30 17:36:04 CEST 2015
https://hg.python.org/cpython/rev/0a7380984e37
changeset: 96383:0a7380984e37
branch: 3.5
parent: 96381:1c11e0de934a
user: Eric Snow <ericsnowcurrently at gmail.com>
date: Sat May 30 09:29:53 2015 -0600
summary:
Issue #16991: Use PyObject_TypeCheck instead of PyObject_IsInstance.
files:
Include/dictobject.h | 6 +++---
Include/odictobject.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Include/dictobject.h b/Include/dictobject.h
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -45,9 +45,9 @@
#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))
diff --git a/Include/odictobject.h b/Include/odictobject.h
--- a/Include/odictobject.h
+++ b/Include/odictobject.h
@@ -19,7 +19,7 @@
#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)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list