From: Martin v. Löwis Date: Mon, 5 Aug 2002 01:49:16 +0000 (+0000) Subject: Add 1 to lineno in deprecation warning. Fixes #590888. X-Git-Tag: v2.3c1~4709 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=725bb233b9492eb4b5532d84b60db5daa1e6b195;p=python Add 1 to lineno in deprecation warning. Fixes #590888. --- diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 53c883f5e4..18884fe733 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; }