mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Use PyErr_WarnExplicit() to warn about hex/oct constants, so the
correct filename and line number are reported.
This commit is contained in:
parent
7a1703d8cb
commit
715eca932e
1 changed files with 9 additions and 4 deletions
|
@ -1157,10 +1157,15 @@ parsenumber(struct compiling *co, char *s)
|
||||||
if (s[0] == '0') {
|
if (s[0] == '0') {
|
||||||
x = (long) PyOS_strtoul(s, &end, 0);
|
x = (long) PyOS_strtoul(s, &end, 0);
|
||||||
if (x < 0 && errno == 0) {
|
if (x < 0 && errno == 0) {
|
||||||
if (PyErr_Warn(PyExc_DeprecationWarning,
|
if (PyErr_WarnExplicit(
|
||||||
"hex/oct constants > sys.maxint "
|
PyExc_DeprecationWarning,
|
||||||
"will return positive values "
|
"hex/oct constants > sys.maxint "
|
||||||
"in Python 2.4 and up") < 0)
|
"will return positive values "
|
||||||
|
"in Python 2.4 and up",
|
||||||
|
co->c_filename,
|
||||||
|
co->c_lineno,
|
||||||
|
NULL,
|
||||||
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
errno = 0; /* Might be changed by PyErr_Warn() */
|
errno = 0; /* Might be changed by PyErr_Warn() */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue