~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_static_tuple_py.py

  • Committer: John Arbash Meinel
  • Date: 2009-10-01 19:06:35 UTC
  • mto: (4679.6.1 2.1-export-c-api)
  • mto: This revision was merged to the branch mainline in revision 4735.
  • Revision ID: john@arbash-meinel.com-20091001190635-m0531rj2mebmhjq0
Add a _static_tuple_c.pxd file to define the C api to pyrex code.

I had to drop the notion of void*items[1] and then subtracting it from tp_basicsize
because Pyrex directly checks that sizeof(struct) == tp_basicsize. I understand
why it was doing so, but it was very hard to track down. The error during
import was basically suppressed, and then I just got segfaults because
the type wasn't actually available.

Anyway, I'm reasonably happy with using a .pxd file, because then I don't have
to worry about getting the invocation right in all callers, though I still
have to repeat the 'from x cimport a,b,c,d' which is a bit annoying.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        return self._tuple
68
68
 
69
69
    def intern(self):
70
 
        return _interned_keys.setdefault(self, self)
 
70
        return _interned_tuples.setdefault(self, self)
71
71
 
72
72
 
73
73
_empty_tuple = None
74
74
_empty_tuple = StaticTuple()
75
 
_interned_keys = {}
 
75
_interned_tuples = {}