[pypy-commit] pypy multiphase: clear exception when module exec sets one without reporting failure
rlamy
pypy.commits at gmail.com
Tue Aug 29 22:56:36 EDT 2017
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: multiphase
Changeset: r92279:7a20909775d3
Date: 2017-08-30 03:55 +0100
http://bitbucket.org/pypy/pypy/changeset/7a20909775d3/
Log: clear exception when module exec sets one without reporting failure
diff --git a/pypy/module/cpyext/modsupport.py b/pypy/module/cpyext/modsupport.py
--- a/pypy/module/cpyext/modsupport.py
+++ b/pypy/module/cpyext/modsupport.py
@@ -152,15 +152,16 @@
execf = rffi.cast(execfunctype, cur_slot[0].c_value)
res = generic_cpy_call(space, execf, w_mod)
has_error = PyErr_Occurred(space) is not None
+ state = space.fromcache(State)
if rffi.cast(lltype.Signed, res):
if has_error:
- state = space.fromcache(State)
state.check_and_raise_exception()
else:
raise oefmt(space.w_SystemError,
"execution of module %S failed without "
"setting an exception", w_mod.w_name)
if has_error:
+ state.clear_exception()
raise oefmt(space.w_SystemError,
"execution of module %S raised unreported "
"exception", w_mod.w_name)
More information about the pypy-commit
mailing list