diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-04 22:04:20 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-04 22:04:20 (GMT) |
commit | a701388de1135241b5a8e4c970e06c0e83a66dc0 (patch) | |
tree | 5faf9071aa6fd65c55424f1e5851bce8634a1bb7 /Objects | |
parent | d4dc6dc9e7e1fc1708c243b308a27e2faf59a3ea (diff) | |
download | cpython-a701388de1135241b5a8e4c970e06c0e83a66dc0.zip cpython-a701388de1135241b5a8e4c970e06c0e83a66dc0.tar.gz cpython-a701388de1135241b5a8e4c970e06c0e83a66dc0.tar.bz2 |
Rename _PyIter_GetBuiltin to _PyObject_GetBuiltin, and do not include it in the stable ABI.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytearrayobject.c | 4 | ||||
-rw-r--r-- | Objects/bytesobject.c | 4 | ||||
-rw-r--r-- | Objects/dictobject.c | 2 | ||||
-rw-r--r-- | Objects/iterobject.c | 21 | ||||
-rw-r--r-- | Objects/listobject.c | 6 | ||||
-rw-r--r-- | Objects/object.c | 13 | ||||
-rw-r--r-- | Objects/rangeobject.c | 4 | ||||
-rw-r--r-- | Objects/setobject.c | 2 | ||||
-rw-r--r-- | Objects/tupleobject.c | 4 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 4 |
10 files changed, 32 insertions, 32 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index be022a4..5b7083d 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -3018,13 +3018,13 @@ static PyObject * bytearrayiter_reduce(bytesiterobject *it) { if (it->it_seq != NULL) { - return Py_BuildValue("N(O)n", _PyIter_GetBuiltin("iter"), + return Py_BuildValue("N(O)n", _PyObject_GetBuiltin("iter"), it->it_seq, it->it_index); } else { PyObject *u = PyUnicode_FromUnicode(NULL, 0); if (u == NULL) return NULL; - return Py_BuildValue("N(N)", _PyIter_GetBuiltin("iter"), u); + return Py_BuildValue("N(N)", _PyObject_GetBuiltin("iter"), u); } } diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 0b95fdf..2e6be43 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -3078,13 +3078,13 @@ static PyObject * striter_reduce(striterobject *it) { if (it->it_seq != NULL) { - return Py_BuildValue("N(O)n", _PyIter_GetBuiltin("iter"), + return Py_BuildValue("N(O)n", _PyObject_GetBuiltin("iter"), it->it_seq, it->it_index); } else { PyObject *u = PyUnicode_FromUnicode(NULL, 0); if (u == NULL) return NULL; - return Py_BuildValue("N(N)", _PyIter_GetBuiltin("iter"), u); + return Py_BuildValue("N(N)", _PyObject_GetBuiltin("iter"), u); } } diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 1924282..3db7a5e 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2610,7 +2610,7 @@ dictiter_reduce(dictiterobject *di) Py_DECREF(list); return NULL; } - return Py_BuildValue("N(N)", _PyIter_GetBuiltin("iter"), list); + return Py_BuildValue("N(N)", _PyObject_GetBuiltin("iter"), list); } /***********************************************/ diff --git a/Objects/iterobject.c b/Objects/iterobject.c index bd0544c..3cfbeaf 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -2,19 +2,6 @@ #include "Python.h" -/* Convenience function to get builtins.iter or builtins.reversed */ -PyObject * -_PyIter_GetBuiltin(const char *iter) -{ - PyObject *mod, *attr; - mod = PyImport_ImportModule("builtins"); - if (mod == NULL) - return NULL; - attr = PyObject_GetAttrString(mod, iter); - Py_DECREF(mod); - return attr; -} - typedef struct { PyObject_HEAD long it_index; @@ -105,10 +92,10 @@ static PyObject * iter_reduce(seqiterobject *it) { if (it->it_seq != NULL) - return Py_BuildValue("N(O)n", _PyIter_GetBuiltin("iter"), + return Py_BuildValue("N(O)n", _PyObject_GetBuiltin("iter"), it->it_seq, it->it_index); else - return Py_BuildValue("N(())", _PyIter_GetBuiltin("iter")); + return Py_BuildValue("N(())", _PyObject_GetBuiltin("iter")); } PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); @@ -242,10 +229,10 @@ static PyObject * calliter_reduce(calliterobject *it) { if (it->it_callable != NULL && it->it_sentinel != NULL) - return Py_BuildValue("N(OO)", _PyIter_GetBuiltin("iter"), + return Py_BuildValue("N(OO)", _PyObject_GetBuiltin("iter"), it->it_callable, it->it_sentinel); else - return Py_BuildValue("N(())", _PyIter_GetBuiltin("iter")); + return Py_BuildValue("N(())", _PyObject_GetBuiltin("iter")); } static PyMethodDef calliter_methods[] = { diff --git a/Objects/listobject.c b/Objects/listobject.c index c8a75f5..e59c9b1 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2949,17 +2949,17 @@ listiter_reduce_general(void *_it, int forward) if (forward) { listiterobject *it = (listiterobject *)_it; if (it->it_seq) - return Py_BuildValue("N(O)l", _PyIter_GetBuiltin("iter"), + return Py_BuildValue("N(O)l", _PyObject_GetBuiltin("iter"), it->it_seq, it->it_index); } else { listreviterobject *it = (listreviterobject *)_it; if (it->it_seq) - return Py_BuildValue("N(O)n", _PyIter_GetBuiltin("reversed"), + return Py_BuildValue("N(O)n", _PyObject_GetBuiltin("reversed"), it->it_seq, it->it_index); } /* empty iterator, create an empty list */ list = PyList_New(0); if (list == NULL) return NULL; - return Py_BuildValue("N(N)", _PyIter_GetBuiltin("iter"), list); + return Py_BuildValue("N(N)", _PyObject_GetBuiltin("iter"), list); } diff --git a/Objects/object.c b/Objects/object.c index 1b7f609..5bafbc0 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1026,6 +1026,19 @@ PyObject_SelfIter(PyObject *obj) return obj; } +/* Convenience function to get a builtin from its name */ +PyObject * +_PyObject_GetBuiltin(const char *name) +{ + PyObject *mod, *attr; + mod = PyImport_ImportModule("builtins"); + if (mod == NULL) + return NULL; + attr = PyObject_GetAttrString(mod, name); + Py_DECREF(mod); + return attr; +} + /* Helper used when the __next__ method is removed from a type: tp_iternext is never NULL and can be safely called without checking on every iteration. diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 660de84..99544d6 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -985,7 +985,7 @@ rangeiter_reduce(rangeiterobject *r) if (range == NULL) goto err; /* return the result */ - return Py_BuildValue("N(N)i", _PyIter_GetBuiltin("iter"), range, r->index); + return Py_BuildValue("N(N)i", _PyObject_GetBuiltin("iter"), range, r->index); err: Py_XDECREF(start); Py_XDECREF(stop); @@ -1171,7 +1171,7 @@ longrangeiter_reduce(longrangeiterobject *r) } /* return the result */ - return Py_BuildValue("N(N)O", _PyIter_GetBuiltin("iter"), range, r->index); + return Py_BuildValue("N(N)O", _PyObject_GetBuiltin("iter"), range, r->index); } static PyObject * diff --git a/Objects/setobject.c b/Objects/setobject.c index 7cd87d3..b903fbee 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -856,7 +856,7 @@ setiter_reduce(setiterobject *si) Py_DECREF(list); return NULL; } - return Py_BuildValue("N(N)", _PyIter_GetBuiltin("iter"), list); + return Py_BuildValue("N(N)", _PyObject_GetBuiltin("iter"), list); } PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 4af4a49..d103b9b 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -971,10 +971,10 @@ static PyObject * tupleiter_reduce(tupleiterobject *it) { if (it->it_seq) - return Py_BuildValue("N(O)l", _PyIter_GetBuiltin("iter"), + return Py_BuildValue("N(O)l", _PyObject_GetBuiltin("iter"), it->it_seq, it->it_index); else - return Py_BuildValue("N(())", _PyIter_GetBuiltin("iter")); + return Py_BuildValue("N(())", _PyObject_GetBuiltin("iter")); } static PyObject * diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index aee832a..1d8a176 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -14386,13 +14386,13 @@ static PyObject * unicodeiter_reduce(unicodeiterobject *it) { if (it->it_seq != NULL) { - return Py_BuildValue("N(O)n", _PyIter_GetBuiltin("iter"), + return Py_BuildValue("N(O)n", _PyObject_GetBuiltin("iter"), it->it_seq, it->it_index); } else { PyObject *u = PyUnicode_FromUnicode(NULL, 0); if (u == NULL) return NULL; - return Py_BuildValue("N(N)", _PyIter_GetBuiltin("iter"), u); + return Py_BuildValue("N(N)", _PyObject_GetBuiltin("iter"), u); } } |