diff options
author | Raymond Hettinger <python@rcn.com> | 2008-03-18 23:22:29 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-03-18 23:22:29 (GMT) |
commit | 9a47e6201f7604f96d302d90eea2a1dd382c491f (patch) | |
tree | 13764f750d3801db568cd4d026f74068d7b14ae5 /Objects | |
parent | c856fa811dfdd6d17396d9aa522eea19b0f46c93 (diff) | |
download | cpython-9a47e6201f7604f96d302d90eea2a1dd382c491f.zip cpython-9a47e6201f7604f96d302d90eea2a1dd382c491f.tar.gz cpython-9a47e6201f7604f96d302d90eea2a1dd382c491f.tar.bz2 |
Speed-up isinstance() for one easy case.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 0ea26d6..3315b0e 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2909,6 +2909,11 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls) static PyObject *name = NULL; PyObject *t, *v, *tb; PyObject *checker; + + /* Quick test for an exact match */ + if (Py_TYPE(inst) == cls) + return 1; + PyErr_Fetch(&t, &v, &tb); if (name == NULL) { |