Staging
v0.5.1
https://github.com/python/cpython
Revision 397935f4a3eb55810478910e4a0443f1fcb5bcb5 authored by Andrew M. Kuchling on 03 October 2006, 19:39:54 UTC, committed by Andrew M. Kuchling on 03 October 2006, 19:39:54 UTC
It's very unlikely, though possible that source is not a string.  Verify
that PyString_AsString() returns a valid pointer.  (The problem can
arise when zlib.decompress doesn't return a string.)

Klocwork 346
1 parent 1673922
Raw File
Tip revision: 397935f4a3eb55810478910e4a0443f1fcb5bcb5 authored by Andrew M. Kuchling on 03 October 2006, 19:39:54 UTC
[Backport r51252 | neal.norwitz]
Tip revision: 397935f
setobject.h

/* Set object interface */

#ifndef Py_SETOBJECT_H
#define Py_SETOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif

/*
This data structure is shared by set and frozenset objects.
*/

typedef struct {
	PyObject_HEAD
	PyObject *data;
	long hash;	/* only used by frozenset objects */
	PyObject *weakreflist; /* List of weak references */

	/* Invariants:
	 *     data is a dictionary whose values are all True.
	 *     data points to the same dict for the whole life of the set.
	 * For frozensets only:
	 *     data is immutable.
	 *     hash is the hash of the frozenset or -1 if not computed yet.
	 */
} PySetObject;

PyAPI_DATA(PyTypeObject) PySet_Type;
PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;

#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)
#define PyAnySet_Check(ob) \
	((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type || \
	  PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
	  PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))

#ifdef __cplusplus
}
#endif
#endif /* !Py_SETOBJECT_H */
back to top