Skip to content
Snippets Groups Projects
Commit 53c75199 authored by Stuart Gathman's avatar Stuart Gathman
Browse files

Generate special exception when callback return not int.

parent b3d63281
Branches
Tags
No related merge requests found
...@@ -35,6 +35,9 @@ $ python setup.py help ...@@ -35,6 +35,9 @@ $ python setup.py help
libraries=["milter","smutil","resolv"] libraries=["milter","smutil","resolv"]
* $Log$ * $Log$
* Revision 1.27 2009/07/28 21:45:54 customdesigned
* Add getversion() to return runtime version.
*
* Revision 1.26 2009/07/28 21:08:20 customdesigned * Revision 1.26 2009/07/28 21:08:20 customdesigned
* Increment del count. * Increment del count.
* *
...@@ -631,9 +634,13 @@ _generic_wrapper(milter_ContextObject *self, PyObject *cb, PyObject *arglist) { ...@@ -631,9 +634,13 @@ _generic_wrapper(milter_ContextObject *self, PyObject *cb, PyObject *arglist) {
result = PyEval_CallObject(cb, arglist); result = PyEval_CallObject(cb, arglist);
Py_DECREF(arglist); Py_DECREF(arglist);
if (result == NULL) return _report_exception(self); if (result == NULL) return _report_exception(self);
retval = PyInt_AsLong(result); if (!PyInt_Check(result)) {
Py_DECREF(result);
PyErr_SetString(MilterError,"callback methods must return int");
return _report_exception(self);
}
retval = PyInt_AS_LONG(result);
Py_DECREF(result); Py_DECREF(result);
if (PyErr_Occurred()) return _report_exception(self);
_release_thread(self->t); _release_thread(self->t);
return retval; return retval;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment