Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 42898:0020bc784c76
Some changes in preparation of stricter rules about mixing str and bytes.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 27 Aug 2007 15:02:28 +0000 |
| parents | 824b9d52e006 |
| children | a49665f8d2f4 |
line wrap: on
line diff
--- a/Python/bltinmodule.c Mon Aug 27 11:33:42 2007 +0000 +++ b/Python/bltinmodule.c Mon Aug 27 15:02:28 2007 +0000 @@ -403,18 +403,16 @@ char *str; Py_ssize_t size; - if (!PyObject_CheckReadBuffer(cmd) && - !PyUnicode_Check(cmd)) { - PyErr_SetString(PyExc_TypeError, - "eval()/exec() arg 1 must be a string, bytes or code object"); - return NULL; - } - if (PyUnicode_Check(cmd)) { cmd = _PyUnicode_AsDefaultEncodedString(cmd, NULL); if (cmd == NULL) return NULL; } + else if (!PyObject_CheckReadBuffer(cmd)) { + PyErr_SetString(PyExc_TypeError, + "eval()/exec() arg 1 must be a string, bytes or code object"); + return NULL; + } if (PyObject_AsReadBuffer(cmd, (const void **)&str, &size) < 0) { return NULL; }
