Author: Armin Rigo <[email protected]>
Branch:
Changeset: r44884:10e84632d7e8
Date: 2011-06-11 10:55 +0200
http://bitbucket.org/pypy/pypy/changeset/10e84632d7e8/
Log: I *think* it's a good idea to do this in that order instead. It
matches the change of order done in the x86 jit backend, too.
diff --git a/pypy/rpython/lltypesystem/rffi.py
b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -139,10 +139,10 @@
source = py.code.Source("""
def call_external_function(%(argnames)s):
before = aroundstate.before
- after = aroundstate.after
if before: before()
# NB. it is essential that no exception checking occurs here!
res = funcptr(%(argnames)s)
+ after = aroundstate.after
if after: after()
return res
""" % locals())
@@ -262,13 +262,9 @@
def wrapper(%s): # no *args - no GIL for mallocing the tuple
llop.gc_stack_bottom(lltype.Void) # marker for trackgcroot.py
if aroundstate is not None:
- before = aroundstate.before
after = aroundstate.after
- else:
- before = None
- after = None
- if after:
- after()
+ if after:
+ after()
# from now on we hold the GIL
stackcounter.stacks_counter += 1
try:
@@ -282,8 +278,10 @@
traceback.print_exc()
result = errorcode
stackcounter.stacks_counter -= 1
- if before:
- before()
+ if aroundstate is not None:
+ before = aroundstate.before
+ if before:
+ before()
# here we don't hold the GIL any more. As in the wrapper() produced
# by llexternal, it is essential that no exception checking occurs
# after the call to before().
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit