[Python-checkins] r87753 - in python/branches/py3k: Objects/codeobject.c Parser/tokenizer.c

victor.stinner python-checkins at python.org
Wed Jan 5 04:33:26 CET 2011


Author: victor.stinner
Date: Wed Jan  5 04:33:26 2011
New Revision: 87753

Log:
Remove arbitrary string length limits

PyUnicode_FromFormat() and PyErr_Format() allocates a buffer of the needed
size, it is no more a fixed-buffer of 500 bytes.

Modified:
   python/branches/py3k/Objects/codeobject.c
   python/branches/py3k/Parser/tokenizer.c

Modified: python/branches/py3k/Objects/codeobject.c
==============================================================================
--- python/branches/py3k/Objects/codeobject.c	(original)
+++ python/branches/py3k/Objects/codeobject.c	Wed Jan  5 04:33:26 2011
@@ -347,11 +347,11 @@
         lineno = -1;
     if (co->co_filename && PyUnicode_Check(co->co_filename)) {
         return PyUnicode_FromFormat(
-            "<code object %.100U at %p, file \"%.300U\", line %d>",
+            "<code object %U at %p, file \"%U\", line %d>",
             co->co_name, co, co->co_filename, lineno);
     } else {
         return PyUnicode_FromFormat(
-            "<code object %.100U at %p, file ???, line %d>",
+            "<code object %U at %p, file ???, line %d>",
             co->co_name, co, lineno);
     }
 }

Modified: python/branches/py3k/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k/Parser/tokenizer.c	(original)
+++ python/branches/py3k/Parser/tokenizer.c	Wed Jan  5 04:33:26 2011
@@ -590,7 +590,7 @@
         if (filename != NULL) {
             PyErr_Format(PyExc_SyntaxError,
                     "Non-UTF-8 code starting with '\\x%.2x' "
-                    "in file %.200U on line %i, "
+                    "in file %U on line %i, "
                     "but no encoding declared; "
                     "see http://python.org/dev/peps/pep-0263/ for details",
                     badchar, filename, tok->lineno + 1);


More information about the Python-checkins mailing list