summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bufferobject.c4
-rw-r--r--Objects/cellobject.c5
-rw-r--r--Objects/codeobject.c6
-rw-r--r--Objects/dictobject.c12
-rw-r--r--Objects/exceptions.c18
-rw-r--r--Objects/fileobject.c8
-rw-r--r--Objects/listobject.c4
-rw-r--r--Objects/methodobject.c6
-rw-r--r--Objects/object.c8
-rw-r--r--Objects/typeobject.c4
10 files changed, 26 insertions, 49 deletions
diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c
index f4c69a0..37d9bcb 100644
--- a/Objects/bufferobject.c
+++ b/Objects/bufferobject.c
@@ -233,9 +233,7 @@ buffer_new(PyTypeObject *type, PyObject *args, PyObject *kw)
Py_ssize_t offset = 0;
Py_ssize_t size = Py_END_OF_BUFFER;
- if (Py_Py3kWarningFlag &&
- PyErr_WarnEx(PyExc_DeprecationWarning,
- "buffer() not supported in 3.x; "
+ if (PyErr_WarnPy3k("buffer() not supported in 3.x; "
"use memoryview()", 1) < 0)
return NULL;
diff --git a/Objects/cellobject.c b/Objects/cellobject.c
index 46955ab..e2a8d29 100644
--- a/Objects/cellobject.c
+++ b/Objects/cellobject.c
@@ -55,9 +55,8 @@ static int
cell_compare(PyCellObject *a, PyCellObject *b)
{
/* Py3K warning for comparisons */
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "cell comparisons not supported in 3.x") < 0) {
+ if (PyErr_WarnPy3k("cell comparisons not supported in 3.x",
+ 1) < 0) {
return -2;
}
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 33b4610..815135d 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -340,10 +340,8 @@ code_richcompare(PyObject *self, PyObject *other, int op)
/* Py3K warning if types are not equal and comparison
isn't == or != */
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "code inequality comparisons not supported "
- "in 3.x") < 0) {
+ if (PyErr_WarnPy3k("code inequality comparisons not supported "
+ "in 3.x", 1) < 0) {
return NULL;
}
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index d552098..2291524 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -1778,10 +1778,8 @@ dict_richcompare(PyObject *v, PyObject *w, int op)
}
else {
/* Py3K warning if comparison isn't == or != */
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "dict inequality comparisons not supported "
- "in 3.x") < 0) {
+ if (PyErr_WarnPy3k("dict inequality comparisons not supported "
+ "in 3.x", 1) < 0) {
return NULL;
}
res = Py_NotImplemented;
@@ -1811,10 +1809,8 @@ dict_contains(register PyDictObject *mp, PyObject *key)
static PyObject *
dict_has_key(register PyDictObject *mp, PyObject *key)
{
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "dict.has_key() not supported in 3.x; "
- "use the in operator") < 0)
+ if (PyErr_WarnPy3k("dict.has_key() not supported in 3.x; "
+ "use the in operator", 1) < 0)
return NULL;
return dict_contains(mp, key);
}
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 2451a91..4a9eba1 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -189,12 +189,9 @@ static PyMethodDef BaseException_methods[] = {
static PyObject *
BaseException_getitem(PyBaseExceptionObject *self, Py_ssize_t index)
{
- if (Py_Py3kWarningFlag) {
- if (PyErr_Warn(PyExc_DeprecationWarning,
- "__getitem__ not supported for exception "
- "classes in 3.x; use args attribute") == -1)
- return NULL;
- }
+ if (PyErr_WarnPy3k("__getitem__ not supported for exception "
+ "classes in 3.x; use args attribute", 1) < 0)
+ return NULL;
return PySequence_GetItem(self->args, index);
}
@@ -202,12 +199,9 @@ static PyObject *
BaseException_getslice(PyBaseExceptionObject *self,
Py_ssize_t start, Py_ssize_t stop)
{
- if (Py_Py3kWarningFlag) {
- if (PyErr_Warn(PyExc_DeprecationWarning,
- "__getslice__ not supported for exception "
- "classes in 3.x; use args attribute") == -1)
- return NULL;
- }
+ if (PyErr_WarnPy3k("__getslice__ not supported for exception "
+ "classes in 3.x; use args attribute", 1) < 0)
+ return NULL;
return PySequence_GetSlice(self->args, start, stop);
}
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index d61e6a0..ef03232 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -1910,9 +1910,7 @@ get_newlines(PyFileObject *f, void *closure)
static PyObject *
get_softspace(PyFileObject *f, void *closure)
{
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "file.softspace not supported in 3.x") < 0)
+ if (PyErr_WarnPy3k("file.softspace not supported in 3.x", 1) < 0)
return NULL;
return PyInt_FromLong(f->f_softspace);
}
@@ -1921,9 +1919,7 @@ static int
set_softspace(PyFileObject *f, PyObject *value)
{
int new;
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "file.softspace not supported in 3.x") < 0)
+ if (PyErr_WarnPy3k("file.softspace not supported in 3.x", 1) < 0)
return -1;
if (value == NULL) {
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 81617e4..e4e8ae4 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2038,9 +2038,7 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
if (compare == Py_None)
compare = NULL;
if (compare != NULL &&
- Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "the cmp argument is not supported in 3.x") < 0)
+ PyErr_WarnPy3k("the cmp argument is not supported in 3.x", 1) < 0)
return NULL;
if (keyfunc == Py_None)
keyfunc = NULL;
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index e641df1..240cc05 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -235,10 +235,8 @@ meth_richcompare(PyObject *self, PyObject *other, int op)
!PyCFunction_Check(other))
{
/* Py3K warning if types are not equal and comparison isn't == or != */
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "builtin_function_or_method inequality "
- "comparisons not supported in 3.x") < 0) {
+ if (PyErr_WarnPy3k("builtin_function_or_method inequality "
+ "comparisons not supported in 3.x", 1) < 0) {
return NULL;
}
diff --git a/Objects/object.c b/Objects/object.c
index e7d84ad..f77f552 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -868,9 +868,9 @@ try_3way_to_rich_compare(PyObject *v, PyObject *w, int op)
/* Py3K warning if types are not equal and comparison isn't == or != */
if (Py_Py3kWarningFlag &&
v->ob_type != w->ob_type && op != Py_EQ && op != Py_NE &&
- PyErr_Warn(PyExc_DeprecationWarning,
+ PyErr_WarnEx(PyExc_DeprecationWarning,
"comparing unequal types not supported "
- "in 3.x") < 0) {
+ "in 3.x", 1) < 0) {
return NULL;
}
@@ -1691,9 +1691,9 @@ merge_list_attr(PyObject* dict, PyObject* obj, const char *attrname)
if (Py_Py3kWarningFlag &&
(strcmp(attrname, "__members__") == 0 ||
strcmp(attrname, "__methods__") == 0)) {
- if (PyErr_Warn(PyExc_DeprecationWarning,
+ if (PyErr_WarnEx(PyExc_DeprecationWarning,
"__members__ and __methods__ not "
- "supported in 3.x") < 0) {
+ "supported in 3.x", 1) < 0) {
Py_XDECREF(list);
return -1;
}
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 6b732dd..54ad714 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -608,9 +608,9 @@ type_richcompare(PyObject *v, PyObject *w, int op)
/* Py3K warning if comparison isn't == or != */
if (Py_Py3kWarningFlag && op != Py_EQ && op != Py_NE &&
- PyErr_Warn(PyExc_DeprecationWarning,
+ PyErr_WarnEx(PyExc_DeprecationWarning,
"type inequality comparisons not supported "
- "in 3.x") < 0) {
+ "in 3.x", 1) < 0) {
return NULL;
}