~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_simple_set_pyx.pyx

  • Committer: Aaron Bentley
  • Date: 2010-05-10 11:34:20 UTC
  • mfrom: (5218 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5221.
  • Revision ID: aaron@aaronbentley.com-20100510113420-toh2d5yioobb5uq1
Merged bzr.dev into transform-commit-full.

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
            raise MemoryError()
116
116
        memset(self._table, 0, n_bytes)
117
117
 
118
 
    def __sizeof__(self):
119
 
        # Note: Pyrex doesn't allow sizeof(class) so we re-implement it here.
120
 
        # Bits are:
121
 
        #   1: PyObject
122
 
        #   2: vtable *
123
 
        #   3: 3 Py_ssize_t
124
 
        #   4: PyObject**
125
 
        # Note that we might get alignment, etc, wrong, but at least this is
126
 
        # better than no estimate at all
127
 
        # return sizeof(SimpleSet) + (self._mask + 1) * (sizeof(PyObject*))
128
 
        return (sizeof(PyObject) + sizeof(void*)
129
 
                + 3*sizeof(Py_ssize_t) + sizeof(PyObject**)
130
 
                + (self._mask + 1) * sizeof(PyObject*))
131
 
 
132
118
    def __dealloc__(self):
133
119
        if self._table != NULL:
134
120
            PyMem_Free(self._table)