|
|
@@ -1917,7 +1917,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
write_function_forset(out, def._remaps, 0, 0, expected_params, 2, true, true,
|
|
|
AT_no_args, return_flags, false);
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " return Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -1957,7 +1957,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
write_function_forset(out, def._remaps, 1, 1, expected_params, 2, true, true,
|
|
|
AT_single_arg, RF_err_null | RF_pyobject, false, !all_nonconst);
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " return Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -2075,7 +2075,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
true, true, AT_varargs, RF_int | RF_decref_args, true);
|
|
|
|
|
|
out << " Py_DECREF(args);\n";
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 8, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -2094,7 +2094,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
write_function_forset(out, delattr_remaps, 1, 1, expected_params, 4,
|
|
|
true, true, AT_single_arg, RF_int, true);
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 8, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -2126,7 +2126,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
out << " if (res != nullptr) {\n";
|
|
|
out << " return res;\n";
|
|
|
out << " }\n";
|
|
|
- out << " if (_PyErr_OCCURRED() != PyExc_AttributeError) {\n";
|
|
|
+ out << " if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {\n";
|
|
|
out << " return nullptr;\n";
|
|
|
out << " }\n";
|
|
|
out << " PyErr_Clear();\n\n";
|
|
|
@@ -2173,7 +2173,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
write_function_forset(out, def._remaps, 1, 1, expected_params, 2, true, true,
|
|
|
AT_no_args, RF_pyobject | RF_err_null, false, true, "index");
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " return Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -2224,7 +2224,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
true, true, AT_single_arg, RF_int, false, true, "index");
|
|
|
out << " }\n\n";
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -2292,7 +2292,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
true, true, AT_single_arg, RF_int, false);
|
|
|
out << " }\n\n";
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -2528,7 +2528,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
true, true, AT_single_arg, return_flags, true);
|
|
|
out << " }\n\n";
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " return Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -2587,7 +2587,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
write_function_forset(out, def._remaps, 1, 1, expected_params, 2, true, true,
|
|
|
AT_single_arg, RF_compare, false, true);
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -2802,7 +2802,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
|
|
|
// End of switch block
|
|
|
out << " }\n\n";
|
|
|
- out << " if (_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (PyErr_Occurred()) {\n";
|
|
|
out << " PyErr_Clear();\n";
|
|
|
out << " }\n\n";
|
|
|
}
|
|
|
@@ -2819,7 +2819,7 @@ write_module_class(ostream &out, Object *obj) {
|
|
|
// no matching comparison operator was found.
|
|
|
out << " // All is not lost; we still have the compare_to function to fall back onto.\n";
|
|
|
out << " int cmpval = " << slots["tp_compare"]._wrapper_name << "(self, arg);\n";
|
|
|
- out << " if (cmpval == -1 && _PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (cmpval == -1 && PyErr_Occurred()) {\n";
|
|
|
out << " if (PyErr_ExceptionMatches(PyExc_TypeError)) {\n";
|
|
|
out << " PyErr_Clear();\n";
|
|
|
out << " } else {\n";
|
|
|
@@ -3961,7 +3961,7 @@ write_function_for_name(ostream &out, Object *obj,
|
|
|
out << "#endif\n";
|
|
|
indent(out, 2) << "}\n";
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n"
|
|
|
+ out << " if (!PyErr_Occurred()) {\n"
|
|
|
<< " ";
|
|
|
if ((return_flags & ~RF_pyobject) == RF_err_null) {
|
|
|
out << "return ";
|
|
|
@@ -4039,7 +4039,7 @@ write_function_for_name(ostream &out, Object *obj,
|
|
|
// figure out a way in the future to better determine when it will be and
|
|
|
// won't be necessary to write this out.
|
|
|
if (args_type != AT_no_args) {
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n"
|
|
|
+ out << " if (!PyErr_Occurred()) {\n"
|
|
|
<< " ";
|
|
|
if ((return_flags & ~RF_pyobject) == RF_err_null) {
|
|
|
out << "return ";
|
|
|
@@ -5217,7 +5217,7 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|
|
extra_convert <<
|
|
|
"size_t arg_val = PyLongOrInt_AsSize_t(arg);\n"
|
|
|
"#ifndef NDEBUG\n"
|
|
|
- "if (arg_val == (size_t)-1 && _PyErr_OCCURRED()) {\n";
|
|
|
+ "if (arg_val == (size_t)-1 && PyErr_Occurred()) {\n";
|
|
|
error_return(extra_convert, 2, return_flags);
|
|
|
extra_convert <<
|
|
|
"}\n"
|
|
|
@@ -6317,7 +6317,7 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|
|
// terminate on error.
|
|
|
if (!may_raise_typeerror || report_errors) {
|
|
|
indent(out, indent_level)
|
|
|
- << "if (_PyErr_OCCURRED()) {\n";
|
|
|
+ << "if (PyErr_Occurred()) {\n";
|
|
|
} else {
|
|
|
// If a method is some extension method that takes a PyObject*, and it
|
|
|
// raised a TypeError, continue. The documentation tells us not to
|
|
|
@@ -6326,7 +6326,7 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|
|
// the TypeError we want to catch here is going to be generated by a
|
|
|
// PyErr_SetString call, not by user code.
|
|
|
indent(out, indent_level)
|
|
|
- << "PyObject *exception = _PyErr_OCCURRED();\n";
|
|
|
+ << "PyObject *exception = PyErr_Occurred();\n";
|
|
|
indent(out, indent_level)
|
|
|
<< "if (exception == PyExc_TypeError) {\n";
|
|
|
indent(out, indent_level)
|
|
|
@@ -6886,7 +6886,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
|
|
|
write_function_forset(out, remaps, 1, 1, expected_params, 2, true, true,
|
|
|
AT_no_args, RF_pyobject | RF_err_null, false, true, "index");
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " return Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n"
|
|
|
@@ -6952,7 +6952,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
|
|
|
expected_params, 2, true, true, AT_single_arg,
|
|
|
RF_int, false, false, "index");
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -6981,7 +6981,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
|
|
|
expected_params, 2, true, true, AT_single_arg,
|
|
|
RF_pyobject | RF_err_null, false, false, "index");
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -7049,7 +7049,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
|
|
|
write_function_forset(out, remaps, 1, 1, expected_params, 2, true, true,
|
|
|
AT_single_arg, RF_pyobject | RF_err_null, false, true);
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " return Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n"
|
|
|
@@ -7128,7 +7128,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
|
|
|
expected_params, 2, true, true, AT_varargs,
|
|
|
RF_int | RF_decref_args, false, false);
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|
|
|
@@ -7178,7 +7178,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
|
|
|
write_function_forset(out, remaps, 1, 1, expected_params, 2, true, true,
|
|
|
AT_no_args, RF_pyobject | RF_err_null, false, true, "index");
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " return Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n"
|
|
|
@@ -7375,7 +7375,7 @@ write_getset(ostream &out, Object *obj, Property *property) {
|
|
|
expected_params, 2, true, true, AT_single_arg,
|
|
|
RF_int, false, false);
|
|
|
|
|
|
- out << " if (!_PyErr_OCCURRED()) {\n";
|
|
|
+ out << " if (!PyErr_Occurred()) {\n";
|
|
|
out << " Dtool_Raise_BadArgumentsError(\n";
|
|
|
output_quoted(out, 6, expected_params);
|
|
|
out << ");\n";
|