[Python-3000-checkins] r52878 - python/branches/p3yk/Python/bltinmodule.c
georg.brandl
python-3000-checkins at python.org
Thu Nov 30 23:46:03 CET 2006
Author: georg.brandl
Date: Thu Nov 30 23:46:03 2006
New Revision: 52878
Modified:
python/branches/p3yk/Python/bltinmodule.c
Log:
Check "sep" and "end" for stringness in Print().
Modified: python/branches/p3yk/Python/bltinmodule.c
==============================================================================
--- python/branches/p3yk/Python/bltinmodule.c (original)
+++ python/branches/p3yk/Python/bltinmodule.c Thu Nov 30 23:46:03 2006
@@ -1429,7 +1429,20 @@
if (file == NULL || file == Py_None)
file = PySys_GetObject("stdout");
- /* XXX Verify that sep and end are None, NULL or strings. */
+ if (sep && sep != Py_None && !PyString_Check(sep) &&
+ !PyUnicode_Check(sep)) {
+ PyErr_Format(PyExc_TypeError,
+ "sep must be None, str or unicode, not %.200s",
+ sep->ob_type->tp_name);
+ return NULL;
+ }
+ if (end && end != Py_None && !PyString_Check(end) &&
+ !PyUnicode_Check(end)) {
+ PyErr_Format(PyExc_TypeError,
+ "end must be None, str or unicode, not %.200s",
+ end->ob_type->tp_name);
+ return NULL;
+ }
for (i = 0; i < PyTuple_Size(args); i++) {
if (i > 0) {
More information about the Python-3000-checkins
mailing list