diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytearrayobject.c | 4 | ||||
-rw-r--r-- | Objects/frameobject.c | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 0d256b9..a76f827 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -447,7 +447,7 @@ bytes_setslice(PyByteArrayObject *self, Py_ssize_t lo, Py_ssize_t hi, else { if (_getbuffer(values, &vbytes) < 0) { PyErr_Format(PyExc_TypeError, - "can't set bytes slice from %.100s", + "can't set bytearray slice from %.100s", Py_TYPE(values)->tp_name); return -1; } @@ -699,7 +699,7 @@ bytes_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds) } /* Parse arguments */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oss:bytes", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oss:bytearray", kwlist, &arg, &encoding, &errors)) return -1; diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 035c2c5..01fb565 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -909,9 +909,12 @@ PyFrame_LocalsToFast(PyFrameObject *f, int clear) if (ncells || nfreevars) { dict_to_map(co->co_cellvars, ncells, locals, fast + co->co_nlocals, 1, clear); - dict_to_map(co->co_freevars, nfreevars, - locals, fast + co->co_nlocals + ncells, 1, - clear); + /* Same test as in PyFrame_FastToLocals() above. */ + if (co->co_flags & CO_OPTIMIZED) { + dict_to_map(co->co_freevars, nfreevars, + locals, fast + co->co_nlocals + ncells, 1, + clear); + } } PyErr_Restore(error_type, error_value, error_traceback); } |