diff options
author | Guido van Rossum <guido@python.org> | 2007-08-27 15:02:28 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-08-27 15:02:28 (GMT) |
commit | a4b8d1de7c8bdacfa07f9545fcef81fee1c6601f (patch) | |
tree | c9a38216a2531622c7785490a8d66c34d9a32e2b /Python/bltinmodule.c | |
parent | ddd25825c839cbae9dcc6c9a7c662d06ee113ca0 (diff) | |
download | cpython-a4b8d1de7c8bdacfa07f9545fcef81fee1c6601f.zip cpython-a4b8d1de7c8bdacfa07f9545fcef81fee1c6601f.tar.gz cpython-a4b8d1de7c8bdacfa07f9545fcef81fee1c6601f.tar.bz2 |
Some changes in preparation of stricter rules about mixing str and bytes.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 22a57ea..284910d 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -403,18 +403,16 @@ source_as_string(PyObject *cmd) 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; } |