Kaydet (Commit) 9f007395 authored tarafından Barry Warsaw's avatar Barry Warsaw

Added a FutureWarning for constructs that will change semantically in

the future.  Changed PEP 237 hex constant warnings from
DeprecationWarning to FutureWarning.  Updated the documentation.
üst 31d2df5b
...@@ -70,6 +70,7 @@ PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning; ...@@ -70,6 +70,7 @@ PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning;
PyAPI_DATA(PyObject *) PyExc_SyntaxWarning; PyAPI_DATA(PyObject *) PyExc_SyntaxWarning;
PyAPI_DATA(PyObject *) PyExc_OverflowWarning; PyAPI_DATA(PyObject *) PyExc_OverflowWarning;
PyAPI_DATA(PyObject *) PyExc_RuntimeWarning; PyAPI_DATA(PyObject *) PyExc_RuntimeWarning;
PyAPI_DATA(PyObject *) PyExc_FutureWarning;
/* Convenience functions */ /* Convenience functions */
......
...@@ -1158,7 +1158,7 @@ parsenumber(struct compiling *co, char *s) ...@@ -1158,7 +1158,7 @@ parsenumber(struct compiling *co, char *s)
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_WarnExplicit( if (PyErr_WarnExplicit(
PyExc_DeprecationWarning, PyExc_FutureWarning,
"hex/oct constants > sys.maxint " "hex/oct constants > sys.maxint "
"will return positive values " "will return positive values "
"in Python 2.4 and up", "in Python 2.4 and up",
......
...@@ -112,7 +112,8 @@ Exception\n\ ...@@ -112,7 +112,8 @@ Exception\n\
+-- PendingDeprecationWarning\n\ +-- PendingDeprecationWarning\n\
+-- SyntaxWarning\n\ +-- SyntaxWarning\n\
+-- OverflowWarning\n\ +-- OverflowWarning\n\
+-- RuntimeWarning" +-- RuntimeWarning\n\
+-- FutureWarning"
); );
...@@ -902,6 +903,10 @@ PyDoc_STRVAR(OverflowWarning__doc__, ...@@ -902,6 +903,10 @@ PyDoc_STRVAR(OverflowWarning__doc__,
PyDoc_STRVAR(RuntimeWarning__doc__, PyDoc_STRVAR(RuntimeWarning__doc__,
"Base class for warnings about dubious runtime behavior."); "Base class for warnings about dubious runtime behavior.");
PyDoc_STRVAR(FutureWarning__doc__,
"Base class for warnings about constructs that will change semantically "
"in the future.");
/* module global functions */ /* module global functions */
...@@ -964,6 +969,7 @@ PyObject *PyExc_PendingDeprecationWarning; ...@@ -964,6 +969,7 @@ PyObject *PyExc_PendingDeprecationWarning;
PyObject *PyExc_SyntaxWarning; PyObject *PyExc_SyntaxWarning;
PyObject *PyExc_OverflowWarning; PyObject *PyExc_OverflowWarning;
PyObject *PyExc_RuntimeWarning; PyObject *PyExc_RuntimeWarning;
PyObject *PyExc_FutureWarning;
...@@ -1044,6 +1050,8 @@ static struct { ...@@ -1044,6 +1050,8 @@ static struct {
OverflowWarning__doc__}, OverflowWarning__doc__},
{"RuntimeWarning", &PyExc_RuntimeWarning, &PyExc_Warning, {"RuntimeWarning", &PyExc_RuntimeWarning, &PyExc_Warning,
RuntimeWarning__doc__}, RuntimeWarning__doc__},
{"FutureWarning", &PyExc_FutureWarning, &PyExc_Warning,
FutureWarning__doc__},
/* Sentinel */ /* Sentinel */
{NULL} {NULL}
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment