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:
Mark Dickinson 2010-03-05 14:36:20 +00:00
parent 3bbb67273a
commit 1c0c78c61f
2 changed files with 16 additions and 37 deletions

View file

@ -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);
}