mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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.
This commit is contained in:
parent
477efb3944
commit
aaa4e9a438
2 changed files with 3 additions and 3 deletions
|
@ -347,11 +347,11 @@ code_repr(PyCodeObject *co)
|
||||||
lineno = -1;
|
lineno = -1;
|
||||||
if (co->co_filename && PyUnicode_Check(co->co_filename)) {
|
if (co->co_filename && PyUnicode_Check(co->co_filename)) {
|
||||||
return PyUnicode_FromFormat(
|
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);
|
co->co_name, co, co->co_filename, lineno);
|
||||||
} else {
|
} else {
|
||||||
return PyUnicode_FromFormat(
|
return PyUnicode_FromFormat(
|
||||||
"<code object %.100U at %p, file ???, line %d>",
|
"<code object %U at %p, file ???, line %d>",
|
||||||
co->co_name, co, lineno);
|
co->co_name, co, lineno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -590,7 +590,7 @@ decoding_fgets(char *s, int size, struct tok_state *tok)
|
||||||
if (filename != NULL) {
|
if (filename != NULL) {
|
||||||
PyErr_Format(PyExc_SyntaxError,
|
PyErr_Format(PyExc_SyntaxError,
|
||||||
"Non-UTF-8 code starting with '\\x%.2x' "
|
"Non-UTF-8 code starting with '\\x%.2x' "
|
||||||
"in file %.200U on line %i, "
|
"in file %U on line %i, "
|
||||||
"but no encoding declared; "
|
"but no encoding declared; "
|
||||||
"see http://python.org/dev/peps/pep-0263/ for details",
|
"see http://python.org/dev/peps/pep-0263/ for details",
|
||||||
badchar, filename, tok->lineno + 1);
|
badchar, filename, tok->lineno + 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue