Created
September 7, 2010 20:58
-
-
Save saghul/569085 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct { | |
long hash; /* cached hash code for the entry key */ | |
PyObject *key; | |
} setentry; | |
/* | |
This data structure is shared by set and frozenset objects. | |
*/ | |
typedef struct _setobject PySetObject; | |
struct _setobject { | |
PyObject_HEAD | |
Py_ssize_t fill; /* # Active + # Dummy */ | |
Py_ssize_t used; /* # Active */ | |
/* The table contains mask + 1 slots, and that's a power of 2. | |
* We store the mask instead of the size because the mask is more | |
* frequently needed. | |
*/ | |
Py_ssize_t mask; | |
/* table points to smalltable for small tables, else to | |
* additional malloc'ed memory. table is never NULL! This rule | |
* saves repeated runtime null-tests. | |
*/ | |
setentry *table; | |
setentry *(*lookup)(PySetObject *so, PyObject *key, long hash); | |
setentry smalltable[PySet_MINSIZE]; | |
long hash; /* only used by frozenset objects */ | |
PyObject *weakreflist; /* List of weak references */ | |
}; | |
PyAPI_DATA(PyTypeObject) PySet_Type; | |
PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment