mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Fix incorrect stacklevel for DeprecationWarnings originating from the struct module.
Also clean up related tests in test_struct. The stacklevel fix should be backported to 2.6 once that branch is unfrozen.
This commit is contained in:
parent
3bbb67273a
commit
1c0c78c61f
2 changed files with 16 additions and 37 deletions
|
@ -121,7 +121,7 @@ get_pylong(PyObject *v)
|
|||
}
|
||||
#ifdef PY_STRUCT_FLOAT_COERCE
|
||||
if (PyFloat_Check(v)) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, FLOAT_COERCE, 2)<0)
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, FLOAT_COERCE, 1)<0)
|
||||
return NULL;
|
||||
return PyNumber_Long(v);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue