~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_static_tuple_c.h

  • Committer: John Arbash Meinel
  • Date: 2009-10-13 18:00:16 UTC
  • mto: This revision was merged to the branch mainline in revision 4755.
  • Revision ID: john@arbash-meinel.com-20091013180016-y9ciypkm8lor58fx
Implement StaticTuple.from_sequence()

This allows casting from something that *might* be a StaticTuple
into something that is definitely a StaticTuple, without having to
create a new instance.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
 
75
75
static StaticTuple * StaticTuple_New(Py_ssize_t);
76
76
static StaticTuple * StaticTuple_Intern(StaticTuple *self);
 
77
static StaticTuple * StaticTuple_FromSequence(PyObject *);
77
78
#define StaticTuple_CheckExact(op) (Py_TYPE(op) == &StaticTuple_Type)
78
79
 
79
80
#else
83
84
 
84
85
static StaticTuple *(*StaticTuple_New)(Py_ssize_t);
85
86
static StaticTuple *(*StaticTuple_Intern)(StaticTuple *);
 
87
static StaticTuple *(*StaticTuple_FromSequence)(PyObject *);
86
88
static PyTypeObject *_p_StaticTuple_Type;
87
89
 
88
90
#define StaticTuple_CheckExact(op) (Py_TYPE(op) == _p_StaticTuple_Type)
98
100
            "StaticTuple *(Py_ssize_t)"},
99
101
        {"StaticTuple_Intern", (void **)&StaticTuple_Intern,
100
102
            "StaticTuple *(StaticTuple *)"},
 
103
        {"StaticTuple_FromSequence", (void **)&StaticTuple_FromSequence,
 
104
            "StaticTuple *(PyObject *)"},
101
105
        {"_StaticTuple_CheckExact", (void **)&_StaticTuple_CheckExact,
102
106
            "int(PyObject *)"},
103
107
        {NULL}};