summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-08-05 01:49:16 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-08-05 01:49:16 (GMT)
commit725bb233b9492eb4b5532d84b60db5daa1e6b195 (patch)
tree82c7dade11b96ea527626b7f7921f0fae2667504
parent4c561b36a05d8b45ef9ac0ac7571f4a97dc2b42b (diff)
downloadcpython-725bb233b9492eb4b5532d84b60db5daa1e6b195.zip
cpython-725bb233b9492eb4b5532d84b60db5daa1e6b195.tar.gz
cpython-725bb233b9492eb4b5532d84b60db5daa1e6b195.tar.bz2
Add 1 to lineno in deprecation warning. Fixes #590888.
-rw-r--r--Parser/tokenizer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 53c883f..18884fe 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -432,8 +432,10 @@ decoding_fgets(char *s, int size, struct tok_state *tok)
char buf[200];
sprintf(buf, "Non-ASCII character '\\x%.2x', "
"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,
- buf, tok->filename, tok->lineno,
+ buf, tok->filename, tok->lineno + 1,
NULL, NULL);
tok->issued_encoding_warning = 1;
}