array_fromfile_as_read(arrayobject *self, PyObject *args)
{
if (PyErr_WarnPy3k("array.read() not supported in 3.x; "
- "use array.fromfile()", 1) < 0)
+ "use array.fromfile()", 1) < 0)
return NULL;
return array_fromfile(self, args);
}
array_tofile_as_write(arrayobject *self, PyObject *f)
{
if (PyErr_WarnPy3k("array.write() not supported in 3.x; "
- "use array.tofile()", 1) < 0)
+ "use array.tofile()", 1) < 0)
return NULL;
return array_tofile(self, f);
}
{
/* Py3K warning for comparisons */
if (PyErr_WarnPy3k("cell comparisons not supported in 3.x",
- 1) < 0) {
+ 1) < 0) {
return -2;
}
!PyCode_Check(other)) {
/* Py3K warning if types are not equal and comparison
- isn't == or != */
+ isn't == or != */
if (PyErr_WarnPy3k("code inequality comparisons not supported "
- "in 3.x", 1) < 0) {
+ "in 3.x", 1) < 0) {
return NULL;
}
else {
/* Py3K warning if comparison isn't == or != */
if (PyErr_WarnPy3k("dict inequality comparisons not supported "
- "in 3.x", 1) < 0) {
+ "in 3.x", 1) < 0) {
return NULL;
}
res = Py_NotImplemented;
dict_has_key(register PyDictObject *mp, PyObject *key)
{
if (PyErr_WarnPy3k("dict.has_key() not supported in 3.x; "
- "use the in operator", 1) < 0)
+ "use the in operator", 1) < 0)
return NULL;
return dict_contains(mp, key);
}
int ret;
ret = PyErr_WarnEx(PyExc_DeprecationWarning,
"BaseException.message has been deprecated as "
- "of Python 2.6",
- 1);
- if (ret == -1)
+ "of Python 2.6", 1);
+ if (ret < 0)
return NULL;
Py_INCREF(self->message);
int ret;
ret = PyErr_WarnEx(PyExc_DeprecationWarning,
"BaseException.message has been deprecated as "
- "of Python 2.6",
- 1);
- if (ret == -1)
+ "of Python 2.6", 1);
+ if (ret < 0)
return -1;
Py_INCREF(val);
Py_DECREF(self->message);
return NULL;
/* Deprecated in 2.6 */
PyErr_Clear();
- if (PyErr_Warn(PyExc_DeprecationWarning,
- "integer argument expected, got float"))
+ if (PyErr_WarnEx(PyExc_DeprecationWarning,
+ "integer argument expected, got float",
+ 1) < 0)
return NULL;
off_index = offobj;
Py_INCREF(offobj);
if (compare == Py_None)
compare = NULL;
if (compare != NULL &&
- PyErr_WarnPy3k("the cmp argument is not supported in 3.x", 1) < 0)
+ PyErr_WarnPy3k("the cmp argument is not supported in 3.x", 1) < 0)
return NULL;
if (keyfunc == Py_None)
keyfunc = NULL;
{
/* Py3K warning if types are not equal and comparison isn't == or != */
if (PyErr_WarnPy3k("builtin_function_or_method inequality "
- "comparisons not supported in 3.x", 1) < 0) {
+ "comparisons not supported in 3.x", 1) < 0) {
return NULL;
}
{
if (name[0] == '_' && name[1] == '_') {
if (strcmp(name, "__methods__") == 0) {
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "__methods__ not supported in 3.x") < 0)
+ if (PyErr_WarnPy3k("__methods__ not supported in 3.x",
+ 1) < 0)
return NULL;
return listmethodchain(chain);
}
PyObject *t = NULL, *retval = NULL;
if (PyErr_WarnPy3k("apply() not supported in 3.x; "
- "use func(*args, **kwargs)", 1) < 0)
+ "use func(*args, **kwargs)", 1) < 0)
return NULL;
if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict))
builtin_callable(PyObject *self, PyObject *v)
{
if (PyErr_WarnPy3k("callable() not supported in 3.x; "
- "use hasattr(o, '__call__')", 1) < 0)
+ "use hasattr(o, '__call__')", 1) < 0)
return NULL;
return PyBool_FromLong((long)PyCallable_Check(v));
}
int exists;
if (PyErr_WarnPy3k("execfile() not supported in 3.x; use exec()",
- 1) < 0)
+ 1) < 0)
return NULL;
if (!PyArg_ParseTuple(args, "s|O!O:execfile",
if (func == Py_None) {
if (PyErr_WarnPy3k("map(None, ...) not supported in 3.x; "
- "use list(...)", 1) < 0)
+ "use list(...)", 1) < 0)
return NULL;
if (n == 1) {
/* map(None, S) is the same as list(S). */
PyObject *seq, *func, *result = NULL, *it;
if (PyErr_WarnPy3k("reduce() not supported in 3.x; "
- "use functools.reduce()", 1) < 0)
+ "use functools.reduce()", 1) < 0)
return NULL;
if (!PyArg_UnpackTuple(args, "reduce", 2, 3, &func, &seq, &result))
builtin_reload(PyObject *self, PyObject *v)
{
if (PyErr_WarnPy3k("In 3.x, reload() is renamed to imp.reload()",
- 1) < 0)
+ 1) < 0)
return NULL;
return PyImport_ReloadModule(v);
/* Not something you can raise. You get an exception
anyway, just not what you specified :-) */
PyErr_Format(PyExc_TypeError,
- "exceptions must be classes or instances, not %s",
- type->ob_type->tp_name);
+ "exceptions must be classes or instances, not %s",
+ type->ob_type->tp_name);
goto raise_error;
}
assert(PyExceptionClass_Check(type));
if (Py_Py3kWarningFlag && PyClass_Check(type)) {
if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "exceptions must derive from BaseException "
- "in 3.x", 1) == -1)
+ "exceptions must derive from BaseException "
+ "in 3.x", 1) < 0)
goto raise_error;
}
PyExc_DeprecationWarning,
"catching of string "
"exceptions is deprecated", 1);
- if (ret_val == -1)
+ if (ret_val < 0)
return NULL;
}
else if (Py_Py3kWarningFlag &&
ret_val = PyErr_WarnEx(
PyExc_DeprecationWarning,
CANNOT_CATCH_MSG, 1);
- if (ret_val == -1)
+ if (ret_val < 0)
return NULL;
}
}
PyExc_DeprecationWarning,
"catching of string "
"exceptions is deprecated", 1);
- if (ret_val == -1)
+ if (ret_val < 0)
return NULL;
}
else if (Py_Py3kWarningFlag &&
ret_val = PyErr_WarnEx(
PyExc_DeprecationWarning,
CANNOT_CATCH_MSG, 1);
- if (ret_val == -1)
+ if (ret_val < 0)
return NULL;
}
}
PyObject *tmp_type, *tmp_value, *tmp_tb;
if (PyErr_WarnPy3k("sys.exc_clear() not supported in 3.x; "
- "use except clauses", 1) < 0)
+ "use except clauses", 1) < 0)
return NULL;
tstate = PyThreadState_GET();