E582 Remove arbitrary string length limits · python/cpython@aaa4e9a · GitHub
[go: up one dir, main page]

Skip to content

Commit aaa4e9a

Browse files
author
Victor Stinner
committed
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.
1 parent 477efb3 commit aaa4e9a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Objects/codeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,11 @@ code_repr(PyCodeObject *co)
347347
lineno = -1;
348348
if (co->co_filename && PyUnicode_Check(co->co_filename)) {
349349
return PyUnicode_FromFormat(
350-
"<code object %.100U at %p, file \"%.300U\", line %d>",
350+
"<code object %U at %p, file \"%U\", line %d>",
351351
co->co_name, co, co->co_filename, lineno);
352352
} else {
353353
return PyUnicode_FromFormat(
354-
"<code object %.100U at %p, file ???, line %d>",
354+
"<code object %U at %p, file ???, line %d>",
355355
co->co_name, co, lineno);
356356
}
357357
}

Parser/tokenizer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ decoding_fgets(char *s, int size, struct tok_state *tok)
590590
if (filename != NULL) {
591591
PyErr_Format(PyExc_SyntaxError,
592592
"Non-UTF-8 code starting with '\\x%.2x' "
593-
"in file %.200U on line %i, "
593+
"in file %U on line %i, "
594594
"but no encoding declared; "
595595
"see http://python.org/dev/peps/pep-0263/ for details",
596596
badchar, filename, tok->lineno + 1);

0 commit comments

Comments
 (0)
0