summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-08-12 21:54:46 (GMT)
committerGuido van Rossum <guido@python.org>2002-08-12 21:54:46 (GMT)
commit715eca932e9ceaefbb4a3dcc21671b02dd7b4112 (patch)
tree407c33c99d4c2f4c4c088a17c3ab42fa556ea6c1 /Python/compile.c
parent7a1703d8cb7e7c50e284033498a87dcb7dc5ab1e (diff)
downloadcpython-715eca932e9ceaefbb4a3dcc21671b02dd7b4112.zip
cpython-715eca932e9ceaefbb4a3dcc21671b02dd7b4112.tar.gz
cpython-715eca932e9ceaefbb4a3dcc21671b02dd7b4112.tar.bz2
Use PyErr_WarnExplicit() to warn about hex/oct constants, so the
correct filename and line number are reported.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Python/compile.c b/Python/compile.c
index dbff9b0..b160f73 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1157,10 +1157,15 @@ parsenumber(struct compiling *co, char *s)
if (s[0] == '0') {
x = (long) PyOS_strtoul(s, &end, 0);
if (x < 0 && errno == 0) {
- if (PyErr_Warn(PyExc_DeprecationWarning,
- "hex/oct constants > sys.maxint "
- "will return positive values "
- "in Python 2.4 and up") < 0)
+ if (PyErr_WarnExplicit(
+ PyExc_DeprecationWarning,
+ "hex/oct constants > sys.maxint "
+ "will return positive values "
+ "in Python 2.4 and up",
+ co->c_filename,
+ co->c_lineno,
+ NULL,
+ NULL) < 0)
return NULL;
errno = 0; /* Might be changed by PyErr_Warn() */
}