diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-28 14:48:19 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-28 14:48:19 +0300 |
commit | f5a86603829104d675112c1aa35f4a7bdd32110e (patch) | |
tree | f3427e72d0382510cc719e3817782ae290ab91ad /Objects/genobject.c | |
parent | 95de54494fb75a30f417c5bba1d0db4d54f57d29 (diff) | |
parent | c7aaeb9022c01fbc190a6c6eb9df9cf7b0c14347 (diff) | |
download | cpython-f5a86603829104d675112c1aa35f4a7bdd32110e.tar.gz |
Issue #27138: Regenerate Python/importlib_external.h.
Diffstat (limited to 'Objects/genobject.c')
-rw-r--r-- | Objects/genobject.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c index f74d044dcf..3ca9696a11 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -187,7 +187,7 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc, int closing) /* Pop the exception before issuing a warning. */ PyErr_Fetch(&exc, &val, &tb); - if (PyErr_WarnFormat(PyExc_PendingDeprecationWarning, 1, + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "generator '%.50S' raised StopIteration", gen->gi_qualname)) { /* Warning was converted to an error. */ @@ -277,7 +277,7 @@ _PyGen_yf(PyGenObject *gen) PyObject *bytecode = f->f_code->co_code; unsigned char *code = (unsigned char *)PyBytes_AS_STRING(bytecode); - if (code[f->f_lasti + 1] != YIELD_FROM) + if (code[f->f_lasti + 2] != YIELD_FROM) return NULL; yf = f->f_stacktop[-1]; Py_INCREF(yf); @@ -376,7 +376,7 @@ gen_throw(PyGenObject *gen, PyObject *args) assert(ret == yf); Py_DECREF(ret); /* Termination repetition of YIELD_FROM */ - gen->gi_frame->f_lasti++; + gen->gi_frame->f_lasti += 2; if (_PyGen_FetchStopIterationValue(&val) == 0) { ret = gen_send_ex(gen, val, 0, 0); Py_DECREF(val); @@ -519,8 +519,6 @@ gen_get_name(PyGenObject *op) static int gen_set_name(PyGenObject *op, PyObject *value) { - PyObject *tmp; - /* Not legal to del gen.gi_name or to set it to anything * other than a string object. */ if (value == NULL || !PyUnicode_Check(value)) { @@ -528,10 +526,8 @@ gen_set_name(PyGenObject *op, PyObject *value) "__name__ must be set to a string object"); return -1; } - tmp = op->gi_name; Py_INCREF(value); - op->gi_name = value; - Py_DECREF(tmp); + Py_XSETREF(op->gi_name, value); return 0; } @@ -545,8 +541,6 @@ gen_get_qualname(PyGenObject *op) static int gen_set_qualname(PyGenObject *op, PyObject *value) { - PyObject *tmp; - /* Not legal to del gen.__qualname__ or to set it to anything * other than a string object. */ if (value == NULL || !PyUnicode_Check(value)) { @@ -554,10 +548,8 @@ gen_set_qualname(PyGenObject *op, PyObject *value) "__qualname__ must be set to a string object"); return -1; } - tmp = op->gi_qualname; Py_INCREF(value); - op->gi_qualname = value; - Py_DECREF(tmp); + Py_XSETREF(op->gi_qualname, value); return 0; } |