mirror of
https://github.com/python/cpython.git
synced 2025-11-12 07:02:33 +00:00
Add 1 to lineno in deprecation warning. Fixes #590888.
This commit is contained in:
parent
4c561b36a0
commit
725bb233b9
1 changed files with 3 additions and 1 deletions
|
|
@ -432,8 +432,10 @@ decoding_fgets(char *s, int size, struct tok_state *tok)
|
||||||
char buf[200];
|
char buf[200];
|
||||||
sprintf(buf, "Non-ASCII character '\\x%.2x', "
|
sprintf(buf, "Non-ASCII character '\\x%.2x', "
|
||||||
"but no declared encoding", badchar);
|
"but no declared encoding", badchar);
|
||||||
|
/* Need to add 1 to the line number, since this line
|
||||||
|
has not been counted, yet. */
|
||||||
PyErr_WarnExplicit(PyExc_DeprecationWarning,
|
PyErr_WarnExplicit(PyExc_DeprecationWarning,
|
||||||
buf, tok->filename, tok->lineno,
|
buf, tok->filename, tok->lineno + 1,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
tok->issued_encoding_warning = 1;
|
tok->issued_encoding_warning = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue