~ubuntu-branches/ubuntu/natty/python3.1/natty-security

« back to all changes in this revision

Viewing changes to Include/dictobject.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-07-06 16:52:42 UTC
  • mfrom: (1.2.1 upstream) (2.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20100706165242-2xv4i019r3et6c0j
Tags: 3.1.2+20100706-1ubuntu1
* Merge with Debian; remaining changes:
  - Regenerate the control file.
  - Add debian/patches/overwrite-semaphore-check for Lucid buildds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
#define PyDict_MINSIZE 8
49
49
 
50
50
typedef struct {
51
 
        /* Cached hash code of me_key.  Note that hash codes are C longs.
52
 
         * We have to use Py_ssize_t instead because dict_popitem() abuses
53
 
         * me_hash to hold a search finger.
54
 
         */
55
 
        Py_ssize_t me_hash;
56
 
        PyObject *me_key;
57
 
        PyObject *me_value;
 
51
    /* Cached hash code of me_key.  Note that hash codes are C longs.
 
52
     * We have to use Py_ssize_t instead because dict_popitem() abuses
 
53
     * me_hash to hold a search finger.
 
54
     */
 
55
    Py_ssize_t me_hash;
 
56
    PyObject *me_key;
 
57
    PyObject *me_value;
58
58
} PyDictEntry;
59
59
 
60
60
/*
68
68
*/
69
69
typedef struct _dictobject PyDictObject;
70
70
struct _dictobject {
71
 
        PyObject_HEAD
72
 
        Py_ssize_t ma_fill;  /* # Active + # Dummy */
73
 
        Py_ssize_t ma_used;  /* # Active */
74
 
 
75
 
        /* The table contains ma_mask + 1 slots, and that's a power of 2.
76
 
         * We store the mask instead of the size because the mask is more
77
 
         * frequently needed.
78
 
         */
79
 
        Py_ssize_t ma_mask;
80
 
 
81
 
        /* ma_table points to ma_smalltable for small tables, else to
82
 
         * additional malloc'ed memory.  ma_table is never NULL!  This rule
83
 
         * saves repeated runtime null-tests in the workhorse getitem and
84
 
         * setitem calls.
85
 
         */
86
 
        PyDictEntry *ma_table;
87
 
        PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
88
 
        PyDictEntry ma_smalltable[PyDict_MINSIZE];
 
71
    PyObject_HEAD
 
72
    Py_ssize_t ma_fill;  /* # Active + # Dummy */
 
73
    Py_ssize_t ma_used;  /* # Active */
 
74
 
 
75
    /* The table contains ma_mask + 1 slots, and that's a power of 2.
 
76
     * We store the mask instead of the size because the mask is more
 
77
     * frequently needed.
 
78
     */
 
79
    Py_ssize_t ma_mask;
 
80
 
 
81
    /* ma_table points to ma_smalltable for small tables, else to
 
82
     * additional malloc'ed memory.  ma_table is never NULL!  This rule
 
83
     * saves repeated runtime null-tests in the workhorse getitem and
 
84
     * setitem calls.
 
85
     */
 
86
    PyDictEntry *ma_table;
 
87
    PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash);
 
88
    PyDictEntry ma_smalltable[PyDict_MINSIZE];
89
89
};
90
90
 
91
91
PyAPI_DATA(PyTypeObject) PyDict_Type;
104
104
#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type)
105
105
/* This excludes Values, since they are not sets. */
106
106
# define PyDictViewSet_Check(op) \
107
 
        (PyDictKeys_Check(op) || PyDictItems_Check(op))
 
107
    (PyDictKeys_Check(op) || PyDictItems_Check(op))
108
108
 
109
109
 
110
110
PyAPI_FUNC(PyObject *) PyDict_New(void);
114
114
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
115
115
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
116
116
PyAPI_FUNC(int) PyDict_Next(
117
 
        PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
 
117
    PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
118
118
PyAPI_FUNC(int) _PyDict_Next(
119
 
        PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash);
 
119
    PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash);
120
120
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
121
121
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
122
122
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
136
136
   dict.update(other) is equivalent to PyDict_Merge(dict, other, 1).
137
137
*/
138
138
PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
139
 
                                   PyObject *other,
140
 
                                   int override);
 
139
                                   PyObject *other,
 
140
                                   int override);
141
141
 
142
142
/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
143
143
   iterable objects of length 2.  If override is true, the last occurrence
145
145
   is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1).
146
146
*/
147
147
PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
148
 
                                           PyObject *seq2,
149
 
                                           int override);
 
148
                                           PyObject *seq2,
 
149
                                           int override);
150
150
 
151
151
PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
152
152
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);