[Python-checkins] r80747 - python/trunk/Objects/abstract.c
brett.cannon
python-checkins at python.org
Tue May 4 03:23:36 CEST 2010
Author: brett.cannon
Date: Tue May 4 03:23:36 2010
New Revision: 80747
Log:
Pull a NULL pointer check up to cover more cases in the function.
Found using Clang's static analyzer.
Modified:
python/trunk/Objects/abstract.c
Modified: python/trunk/Objects/abstract.c
==============================================================================
--- python/trunk/Objects/abstract.c (original)
+++ python/trunk/Objects/abstract.c Tue May 4 03:23:36 2010
@@ -1833,11 +1833,13 @@
int
PySequence_Check(PyObject *s)
{
- if (s && PyInstance_Check(s))
+ if (s == NULL)
+ return 0;
+ if (PyInstance_Check(s))
return PyObject_HasAttrString(s, "__getitem__");
if (PyDict_Check(s))
return 0;
- return s != NULL && s->ob_type->tp_as_sequence &&
+ return s->ob_type->tp_as_sequence &&
s->ob_type->tp_as_sequence->sq_item != NULL;
}
More information about the Python-checkins
mailing list