[Python-checkins] cpython: Issue #13783: PEP 380 cleanup part 2, using the new identifier APIs in the
nick.coghlan
python-checkins at python.org
Sun Jun 17 07:45:31 CEST 2012
http://hg.python.org/cpython/rev/438b861e2edb
changeset: 77477:438b861e2edb
user: Nick Coghlan <ncoghlan at gmail.com>
date: Sun Jun 17 15:45:11 2012 +1000
summary:
Issue #13783: PEP 380 cleanup part 2, using the new identifier APIs in the generator implementation
files:
Misc/NEWS | 2 ++
Objects/genobject.c | 6 ++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,8 @@
Core and Builtins
-----------------
+- Issue #13783: Generator objects now use the identifier APIs internally
+
- Issue #14874: Restore charmap decoding speed to pre-PEP 393 levels.
Patch by Serhiy Storchaka.
diff --git a/Objects/genobject.c b/Objects/genobject.c
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -149,13 +149,14 @@
gen_close_iter(PyObject *yf)
{
PyObject *retval = NULL;
+ _Py_IDENTIFIER(close);
if (PyGen_CheckExact(yf)) {
retval = gen_close((PyGenObject *)yf, NULL);
if (retval == NULL)
return -1;
} else {
- PyObject *meth = PyObject_GetAttrString(yf, "close");
+ PyObject *meth = _PyObject_GetAttrId(yf, &PyId_close);
if (meth == NULL) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError))
PyErr_WriteUnraisable(yf);
@@ -295,6 +296,7 @@
PyObject *tb = NULL;
PyObject *val = NULL;
PyObject *yf = gen_yf(gen);
+ _Py_IDENTIFIER(throw);
if (!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb))
return NULL;
@@ -316,7 +318,7 @@
ret = gen_throw((PyGenObject *)yf, args);
gen->gi_running = 0;
} else {
- PyObject *meth = PyObject_GetAttrString(yf, "throw");
+ PyObject *meth = _PyObject_GetAttrId(yf, &PyId_throw);
if (meth == NULL) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
Py_DECREF(yf);
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list