1
/* Copyright (C) 2009, 2010 Canonical Ltd
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation; either version 2 of the License, or
6
* (at your option) any later version.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
/* Must be defined before importing _static_tuple_c.h so that we get the right
21
#define STATIC_TUPLE_MODULE
24
#include "python-compat.h"
26
#include "_static_tuple_c.h"
27
#include "_export_c_api.h"
29
#include "_simple_set_pyx_api.h"
32
# define inline __inline__
33
#elif defined(_MSC_VER)
34
# define inline __inline
40
/* The one and only StaticTuple with no values */
41
static StaticTuple *_empty_tuple = NULL;
42
static PyObject *_interned_tuples = NULL;
46
_StaticTuple_is_interned(StaticTuple *self)
48
return self->flags & STATIC_TUPLE_INTERNED_FLAG;
54
StaticTuple_as_tuple(StaticTuple *self)
56
PyObject *tpl = NULL, *obj = NULL;
60
tpl = PyTuple_New(len);
65
for (i = 0; i < len; ++i) {
66
obj = (PyObject *)self->items[i];
68
PyTuple_SET_ITEM(tpl, i, obj);
74
static char StaticTuple_as_tuple_doc[] = "as_tuple() => tuple";
77
StaticTuple_Intern(StaticTuple *self)
79
PyObject *canonical_tuple = NULL;
81
if (_interned_tuples == NULL || _StaticTuple_is_interned(self)) {
85
/* SimpleSet_Add returns whatever object is present at self
86
* or the new object if it needs to add it.
88
canonical_tuple = SimpleSet_Add(_interned_tuples, (PyObject *)self);
89
if (!canonical_tuple) {
90
// Some sort of exception, propogate it.
93
if (canonical_tuple != (PyObject *)self) {
94
// There was already a tuple with that value
95
return (StaticTuple *)canonical_tuple;
97
self->flags |= STATIC_TUPLE_INTERNED_FLAG;
98
// The two references in the dict do not count, so that the StaticTuple
99
// object does not become immortal just because it was interned.
100
Py_REFCNT(self) -= 1;
104
static char StaticTuple_Intern_doc[] = "intern() => unique StaticTuple\n"
105
"Return a 'canonical' StaticTuple object.\n"
106
"Similar to intern() for strings, this makes sure there\n"
107
"is only one StaticTuple object for a given value\n."
109
" key = StaticTuple('foo', 'bar').intern()\n";
113
StaticTuple_dealloc(StaticTuple *self)
117
if (_StaticTuple_is_interned(self)) {
118
/* revive dead object temporarily for Discard */
120
if (SimpleSet_Discard(_interned_tuples, (PyObject*)self) != 1)
121
Py_FatalError("deletion of interned StaticTuple failed");
122
self->flags &= ~STATIC_TUPLE_INTERNED_FLAG;
125
for (i = 0; i < len; ++i) {
126
Py_XDECREF(self->items[i]);
128
Py_TYPE(self)->tp_free((PyObject *)self);
132
/* Similar to PyTuple_New() */
134
StaticTuple_New(Py_ssize_t size)
138
if (size < 0 || size > 255) {
139
/* Too big or too small */
140
PyErr_SetString(PyExc_ValueError, "StaticTuple(...)"
141
" takes from 0 to 255 items");
144
if (size == 0 && _empty_tuple != NULL) {
145
Py_INCREF(_empty_tuple);
148
/* Note that we use PyObject_NewVar because we want to allocate a variable
149
* width entry. However we *aren't* truly a PyVarObject because we don't
150
* use a long for ob_size. Instead we use a plain 'size' that is an int,
151
* and will be overloaded with flags in the future.
152
* As such we do the alloc, and then have to clean up anything it does
155
stuple = PyObject_NewVar(StaticTuple, &StaticTuple_Type, size);
156
if (stuple == NULL) {
161
stuple->_unused0 = 0;
162
stuple->_unused1 = 0;
164
memset(stuple->items, 0, sizeof(PyObject *) * size);
166
#if STATIC_TUPLE_HAS_HASH
174
StaticTuple_FromSequence(PyObject *sequence)
176
StaticTuple *new = NULL;
177
PyObject *as_tuple = NULL;
181
if (StaticTuple_CheckExact(sequence)) {
183
return (StaticTuple *)sequence;
185
if (!PySequence_Check(sequence)) {
186
as_tuple = PySequence_Tuple(sequence);
187
if (as_tuple == NULL)
191
size = PySequence_Size(sequence);
195
new = StaticTuple_New(size);
199
for (i = 0; i < size; ++i) {
200
// This returns a new reference, which we then 'steal' with
201
// StaticTuple_SET_ITEM
202
item = PySequence_GetItem(sequence, i);
208
StaticTuple_SET_ITEM(new, i, item);
211
Py_XDECREF(as_tuple);
212
return (StaticTuple *)new;
216
StaticTuple_from_sequence(PyObject *self, PyObject *args, PyObject *kwargs)
219
if (!PyArg_ParseTuple(args, "O", &sequence))
221
return StaticTuple_FromSequence(sequence);
225
/* Check that all items we point to are 'valid' */
227
StaticTuple_check_items(StaticTuple *self)
232
for (i = 0; i < self->size; ++i) {
233
obj = self->items[i];
235
PyErr_SetString(PyExc_RuntimeError, "StaticTuple(...)"
236
" should not have a NULL entry.");
239
if (PyBytes_CheckExact(obj)
240
|| StaticTuple_CheckExact(obj)
243
#if PY_MAJOR_VERSION >= 3
245
|| PyInt_CheckExact(obj)
247
|| PyLong_CheckExact(obj)
248
|| PyFloat_CheckExact(obj)
249
|| PyUnicode_CheckExact(obj)
251
PyErr_Format(PyExc_TypeError, "StaticTuple(...)"
252
" requires that all items are one of"
253
" str, StaticTuple, None, bool, int, long, float, or unicode"
254
" not %s.", Py_TYPE(obj)->tp_name);
261
StaticTuple_new_constructor(PyTypeObject *type, PyObject *args, PyObject *kwds)
264
PyObject *obj = NULL;
265
Py_ssize_t i, len = 0;
267
if (type != &StaticTuple_Type) {
268
PyErr_SetString(PyExc_TypeError, "we only support creating StaticTuple");
271
if (!PyTuple_CheckExact(args)) {
272
PyErr_SetString(PyExc_TypeError, "args must be a tuple");
275
len = PyTuple_GET_SIZE(args);
276
if (len < 0 || len > 255) {
277
/* Check the length here so we can raise a TypeError instead of
278
* StaticTuple_New's ValueError.
280
PyErr_SetString(PyExc_TypeError, "StaticTuple(...)"
281
" takes from 0 to 255 items");
284
self = (StaticTuple *)StaticTuple_New(len);
288
for (i = 0; i < len; ++i) {
289
obj = PyTuple_GET_ITEM(args, i);
291
self->items[i] = obj;
293
if (!StaticTuple_check_items(self)) {
294
type->tp_dealloc((PyObject *)self);
297
return (PyObject *)self;
301
StaticTuple_repr(StaticTuple *self)
303
PyObject *as_tuple, *tuple_repr, *result;
305
as_tuple = StaticTuple_as_tuple(self);
306
if (as_tuple == NULL) {
309
tuple_repr = PyObject_Repr(as_tuple);
311
if (tuple_repr == NULL) {
314
#if PY_MAJOR_VERSION >= 3
315
result = PyUnicode_FromFormat("StaticTuple%U", tuple_repr);
317
result = PyString_FromFormat("StaticTuple%s",
318
PyString_AsString(tuple_repr));
324
StaticTuple_hash(StaticTuple *self)
326
/* adapted from tuplehash(), is the specific hash value considered
330
Py_ssize_t len = self->size;
332
long mult = 1000003L;
334
#if STATIC_TUPLE_HAS_HASH
335
if (self->hash != -1) {
341
// TODO: We could set specific flags if we know that, for example, all the
342
// items are strings. I haven't seen a real-world benefit to that
345
y = PyObject_Hash(*p++);
346
if (y == -1) /* failure */
349
/* the cast might truncate len; that doesn't change hash stability */
350
mult += (long)(82520L + len + len);
355
#if STATIC_TUPLE_HAS_HASH
362
StaticTuple_richcompare_to_tuple(StaticTuple *v, PyObject *wt, int op)
365
PyObject *result = NULL;
367
vt = StaticTuple_as_tuple((StaticTuple *)v);
371
if (!PyTuple_Check(wt)) {
372
PyErr_BadInternalCall();
375
/* Now we have 2 tuples to compare, do it */
376
result = PyTuple_Type.tp_richcompare(vt, wt, op);
382
/** Compare two objects to determine if they are equivalent.
383
* The basic flow is as follows
384
* 1) First make sure that both objects are StaticTuple instances. If they
385
* aren't then cast self to a tuple, and have the tuple do the comparison.
386
* 2) Special case comparison to Py_None, because it happens to occur fairly
387
* often in the test suite.
388
* 3) Special case when v and w are the same pointer. As we know the answer to
389
* all queries without walking individual items.
390
* 4) For all operations, we then walk the items to find the first paired
391
* items that are not equal.
392
* 5) If all items found are equal, we then check the length of self and
393
* other to determine equality.
394
* 6) If an item differs, then we apply "op" to those last two items. (eg.
395
* StaticTuple(A, B) > StaticTuple(A, C) iff B > C)
399
StaticTuple_richcompare(PyObject *v, PyObject *w, int op)
401
StaticTuple *v_st, *w_st;
402
Py_ssize_t vlen, wlen, min_len, i;
403
PyObject *v_obj, *w_obj;
404
richcmpfunc string_richcompare;
406
if (!StaticTuple_CheckExact(v)) {
407
/* This has never triggered, according to python-dev it seems this
408
* might trigger if '__op__' is defined but '__rop__' is not, sort of
409
* case. Such as "None == StaticTuple()"
411
fprintf(stderr, "self is not StaticTuple\n");
412
Py_INCREF(Py_NotImplemented);
413
return Py_NotImplemented;
415
v_st = (StaticTuple *)v;
416
if (StaticTuple_CheckExact(w)) {
417
/* The most common case */
418
w_st = (StaticTuple*)w;
419
} else if (PyTuple_Check(w)) {
420
/* One of v or w is a tuple, so we go the 'slow' route and cast up to
423
/* TODO: This seems to be triggering more than I thought it would...
424
* We probably want to optimize comparing self to other when
427
return StaticTuple_richcompare_to_tuple(v_st, w, op);
428
} else if (w == Py_None) {
429
// None is always less than the object
432
#if PY_MAJOR_VERSION >= 3
434
case Py_GT:case Py_GE:
439
#if PY_MAJOR_VERSION >= 3
441
case Py_LT:case Py_LE:
445
default: // Should only happen on Python 3
446
return Py_NotImplemented;
449
/* We don't special case this comparison, we just let python handle
452
Py_INCREF(Py_NotImplemented);
453
return Py_NotImplemented;
455
/* Now we know that we have 2 StaticTuple objects, so let's compare them.
456
* This code is inspired from tuplerichcompare, except we know our
457
* objects are limited in scope, so we can inline some comparisons.
460
/* Identical pointers, we can shortcut this easily. */
462
case Py_EQ:case Py_LE:case Py_GE:
465
case Py_NE:case Py_LT:case Py_GT:
471
&& _StaticTuple_is_interned(v_st)
472
&& _StaticTuple_is_interned(w_st))
474
/* If both objects are interned, we know they are different if the
475
* pointer is not the same, which would have been handled by the
476
* previous if. No need to compare the entries.
482
/* The only time we are likely to compare items of different lengths is in
483
* something like the interned_keys set. However, the hash is good enough
484
* that it is rare. Note that 'tuple_richcompare' also does not compare
489
min_len = (vlen < wlen) ? vlen : wlen;
490
string_richcompare = PyBytes_Type.tp_richcompare;
491
for (i = 0; i < min_len; i++) {
492
PyObject *result = NULL;
493
v_obj = StaticTuple_GET_ITEM(v_st, i);
494
w_obj = StaticTuple_GET_ITEM(w_st, i);
495
if (v_obj == w_obj) {
496
/* Shortcut case, these must be identical */
499
if (PyBytes_CheckExact(v_obj) && PyBytes_CheckExact(w_obj)) {
500
result = string_richcompare(v_obj, w_obj, Py_EQ);
501
} else if (StaticTuple_CheckExact(v_obj) &&
502
StaticTuple_CheckExact(w_obj))
504
/* Both are StaticTuple types, so recurse */
505
result = StaticTuple_richcompare(v_obj, w_obj, Py_EQ);
507
/* Fall back to generic richcompare */
508
result = PyObject_RichCompare(v_obj, w_obj, Py_EQ);
510
if (result == NULL) {
511
return NULL; /* There seems to be an error */
513
if (result == Py_False) {
514
// This entry is not identical, Shortcut for Py_EQ
521
if (result != Py_True) {
522
/* We don't know *what* richcompare is returning, but it
523
* isn't something we recognize
525
PyErr_BadInternalCall();
532
/* We walked off one of the lists, but everything compared equal so
533
* far. Just compare the size.
538
case Py_LT: cmp = vlen < wlen; break;
539
case Py_LE: cmp = vlen <= wlen; break;
540
case Py_EQ: cmp = vlen == wlen; break;
541
case Py_NE: cmp = vlen != wlen; break;
542
case Py_GT: cmp = vlen > wlen; break;
543
case Py_GE: cmp = vlen >= wlen; break;
544
default: return NULL; /* cannot happen */
553
/* The last item differs, shortcut the Py_NE case */
558
/* It is some other comparison, go ahead and do the real check. */
559
if (PyBytes_CheckExact(v_obj) && PyBytes_CheckExact(w_obj))
561
return string_richcompare(v_obj, w_obj, op);
562
} else if (StaticTuple_CheckExact(v_obj) &&
563
StaticTuple_CheckExact(w_obj))
565
/* Both are StaticTuple types, so recurse */
566
return StaticTuple_richcompare(v_obj, w_obj, op);
568
return PyObject_RichCompare(v_obj, w_obj, op);
574
StaticTuple_length(StaticTuple *self)
581
StaticTuple__is_interned(StaticTuple *self)
583
if (_StaticTuple_is_interned(self)) {
591
static char StaticTuple__is_interned_doc[] = "_is_interned() => True/False\n"
592
"Check to see if this tuple has been interned.\n";
596
StaticTuple_reduce(StaticTuple *self)
598
PyObject *result = NULL, *as_tuple = NULL;
600
result = PyTuple_New(2);
604
as_tuple = StaticTuple_as_tuple(self);
605
if (as_tuple == NULL) {
609
Py_INCREF(&StaticTuple_Type);
610
PyTuple_SET_ITEM(result, 0, (PyObject *)&StaticTuple_Type);
611
PyTuple_SET_ITEM(result, 1, as_tuple);
615
static char StaticTuple_reduce_doc[] = "__reduce__() => tuple\n";
619
StaticTuple_add(PyObject *v, PyObject *w)
621
Py_ssize_t i, len_v, len_w;
624
/* StaticTuples and plain tuples may be added (concatenated) to
627
if (StaticTuple_CheckExact(v)) {
628
len_v = ((StaticTuple*)v)->size;
629
} else if (PyTuple_Check(v)) {
630
len_v = PyTuple_GET_SIZE(v);
632
Py_INCREF(Py_NotImplemented);
633
return Py_NotImplemented;
635
if (StaticTuple_CheckExact(w)) {
636
len_w = ((StaticTuple*)w)->size;
637
} else if (PyTuple_Check(w)) {
638
len_w = PyTuple_GET_SIZE(w);
640
Py_INCREF(Py_NotImplemented);
641
return Py_NotImplemented;
643
result = StaticTuple_New(len_v + len_w);
646
for (i = 0; i < len_v; ++i) {
647
// This returns a new reference, which we then 'steal' with
648
// StaticTuple_SET_ITEM
649
item = PySequence_GetItem(v, i);
654
StaticTuple_SET_ITEM(result, i, item);
656
for (i = 0; i < len_w; ++i) {
657
item = PySequence_GetItem(w, i);
662
StaticTuple_SET_ITEM(result, i+len_v, item);
664
if (!StaticTuple_check_items(result)) {
668
return (PyObject *)result;
672
StaticTuple_item(StaticTuple *self, Py_ssize_t offset)
675
/* We cast to (int) to avoid worrying about whether Py_ssize_t is a
676
* long long, etc. offsets should never be >2**31 anyway.
679
PyErr_Format(PyExc_IndexError, "StaticTuple_item does not support"
680
" negative indices: %d\n", (int)offset);
681
} else if (offset >= self->size) {
682
PyErr_Format(PyExc_IndexError, "StaticTuple index out of range"
683
" %d >= %d", (int)offset, (int)self->size);
686
obj = (PyObject *)self->items[offset];
691
#if PY_MAJOR_VERSION >= 3
694
StaticTuple_slice(StaticTuple *self, Py_ssize_t ilow, Py_ssize_t ihigh)
696
PyObject *as_tuple, *result;
698
as_tuple = StaticTuple_as_tuple(self);
699
if (as_tuple == NULL) {
702
result = PyTuple_Type.tp_as_sequence->sq_slice(as_tuple, ilow, ihigh);
709
StaticTuple_subscript(StaticTuple *self, PyObject *key)
711
PyObject *as_tuple, *result;
713
as_tuple = StaticTuple_as_tuple(self);
714
if (as_tuple == NULL) {
717
result = PyTuple_Type.tp_as_mapping->mp_subscript(as_tuple, key);
723
StaticTuple_traverse(StaticTuple *self, visitproc visit, void *arg)
726
for (i = self->size; --i >= 0;) {
727
Py_VISIT(self->items[i]);
734
StaticTuple_sizeof(StaticTuple *self)
738
res = _PyObject_SIZE(&StaticTuple_Type) + (int)self->size * sizeof(void*);
739
return PyInt_FromSsize_t(res);
744
static char StaticTuple_doc[] =
745
"C implementation of a StaticTuple structure."
746
"\n This is used as StaticTuple(item1, item2, item3)"
747
"\n This is similar to tuple, less flexible in what it"
748
"\n supports, but also lighter memory consumption."
749
"\n Note that the constructor mimics the () form of tuples"
750
"\n Rather than the 'tuple()' constructor."
751
"\n eg. StaticTuple(a, b) == (a, b) == tuple((a, b))";
753
static PyMethodDef StaticTuple_methods[] = {
754
{"as_tuple", (PyCFunction)StaticTuple_as_tuple, METH_NOARGS, StaticTuple_as_tuple_doc},
755
{"intern", (PyCFunction)StaticTuple_Intern, METH_NOARGS, StaticTuple_Intern_doc},
756
{"_is_interned", (PyCFunction)StaticTuple__is_interned, METH_NOARGS,
757
StaticTuple__is_interned_doc},
758
{"from_sequence", (PyCFunction)StaticTuple_from_sequence,
759
METH_STATIC | METH_VARARGS,
760
"Create a StaticTuple from a given sequence. This functions"
761
" the same as the tuple() constructor."},
762
{"__reduce__", (PyCFunction)StaticTuple_reduce, METH_NOARGS, StaticTuple_reduce_doc},
763
{"__sizeof__", (PyCFunction)StaticTuple_sizeof, METH_NOARGS},
764
{NULL, NULL} /* sentinel */
768
static PyNumberMethods StaticTuple_as_number = {
769
(binaryfunc) StaticTuple_add, /* nb_add */
773
0, /* nb_remainder */
790
static PySequenceMethods StaticTuple_as_sequence = {
791
(lenfunc)StaticTuple_length, /* sq_length */
794
(ssizeargfunc)StaticTuple_item, /* sq_item */
795
#if PY_MAJOR_VERSION >= 3
797
(ssizessizeargfunc)StaticTuple_slice, /* sq_slice */
800
0, /* sq_ass_slice */
802
#if PY_MAJOR_VERSION >= 3
803
0, /* sq_inplace_concat */
804
0, /* sq_inplace_repeat */
809
static PyMappingMethods StaticTuple_as_mapping = {
810
(lenfunc)StaticTuple_length, /* mp_length */
811
(binaryfunc)StaticTuple_subscript, /* mp_subscript */
812
0, /* mp_ass_subscript */
816
PyTypeObject StaticTuple_Type = {
817
PyVarObject_HEAD_INIT(NULL, 0)
818
"breezy._static_tuple_c.StaticTuple", /* tp_name */
819
sizeof(StaticTuple), /* tp_basicsize */
820
sizeof(PyObject *), /* tp_itemsize */
821
(destructor)StaticTuple_dealloc, /* tp_dealloc */
826
(reprfunc)StaticTuple_repr, /* tp_repr */
827
&StaticTuple_as_number, /* tp_as_number */
828
&StaticTuple_as_sequence, /* tp_as_sequence */
829
&StaticTuple_as_mapping, /* tp_as_mapping */
830
(hashfunc)StaticTuple_hash, /* tp_hash */
835
0, /* tp_as_buffer */
836
/* Py_TPFLAGS_CHECKTYPES tells the number operations that they shouldn't
837
* try to 'coerce' but instead stuff like 'add' will check it arguments.
839
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags*/
840
StaticTuple_doc, /* tp_doc */
841
/* gc.get_referents checks the IS_GC flag before it calls tp_traverse
842
* And we don't include this object in the garbage collector because we
843
* know it doesn't create cycles. However, 'meliae' will follow
844
* tp_traverse, even if the object isn't GC, and we want that.
846
(traverseproc)StaticTuple_traverse, /* tp_traverse */
848
StaticTuple_richcompare, /* tp_richcompare */
849
0, /* tp_weaklistoffset */
850
// without implementing tp_iter, Python will fall back to PySequence*
851
// which seems to work ok, we may need something faster/lighter in the
855
StaticTuple_methods, /* tp_methods */
860
0, /* tp_descr_get */
861
0, /* tp_descr_set */
862
0, /* tp_dictoffset */
865
StaticTuple_new_constructor, /* tp_new */
869
static PyMethodDef static_tuple_c_methods[] = {
875
setup_interned_tuples(PyObject *m)
877
_interned_tuples = (PyObject *)SimpleSet_New();
878
if (_interned_tuples != NULL) {
879
Py_INCREF(_interned_tuples);
880
PyModule_AddObject(m, "_interned_tuples", _interned_tuples);
886
setup_empty_tuple(PyObject *m)
889
if (_interned_tuples == NULL) {
890
fprintf(stderr, "You need to call setup_interned_tuples() before"
891
" setup_empty_tuple, because we intern it.\n");
893
// We need to create the empty tuple
894
stuple = (StaticTuple *)StaticTuple_New(0);
895
_empty_tuple = StaticTuple_Intern(stuple);
896
assert(_empty_tuple == stuple);
897
// At this point, refcnt is 2: 1 from New(), and 1 from the return from
898
// intern(). We will keep 1 for the _empty_tuple global, and use the other
899
// for the module reference.
900
PyModule_AddObject(m, "_empty_tuple", (PyObject *)_empty_tuple);
904
_StaticTuple_CheckExact(PyObject *obj)
906
return StaticTuple_CheckExact(obj);
910
setup_c_api(PyObject *m)
912
_export_function(m, "StaticTuple_New", StaticTuple_New,
913
"StaticTuple *(Py_ssize_t)");
914
_export_function(m, "StaticTuple_Intern", StaticTuple_Intern,
915
"StaticTuple *(StaticTuple *)");
916
_export_function(m, "StaticTuple_FromSequence", StaticTuple_FromSequence,
917
"StaticTuple *(PyObject *)");
918
_export_function(m, "_StaticTuple_CheckExact", _StaticTuple_CheckExact,
923
PYMOD_INIT_FUNC(_static_tuple_c)
927
StaticTuple_Type.tp_getattro = PyObject_GenericGetAttr;
928
if (PyType_Ready(&StaticTuple_Type) < 0) {
932
PYMOD_CREATE(m, "_static_tuple_c",
933
"C implementation of a StaticTuple structure",
934
static_tuple_c_methods);
939
Py_INCREF(&StaticTuple_Type);
940
PyModule_AddObject(m, "StaticTuple", (PyObject *)&StaticTuple_Type);
941
if (import_breezy___simple_set_pyx() == -1) {
944
setup_interned_tuples(m);
945
setup_empty_tuple(m);
948
return PYMOD_SUCCESS(m);
951
// vim: tabstop=4 sw=4 expandtab