[pypy-commit] pypy default: Fix: we need to check for NULL-ness before calling the aroundstate functions

arigo noreply at buildbot.pypy.org
Thu Feb 27 08:28:42 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r69497:b277ef305108
Date: 2014-02-27 08:24 +0100
http://bitbucket.org/pypy/pypy/changeset/b277ef305108/

Log:	Fix: we need to check for NULL-ness before calling the aroundstate
	functions

diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -122,11 +122,13 @@
 
     @entrypoint('main', [rffi.CCHARP], c_name='pypy_execute_source')
     def pypy_execute_source(ll_source):
-        rffi.aroundstate.after()
+        after = rffi.aroundstate.after
+        if after: after()
         llop.gc_stack_bottom(lltype.Void)
         source = rffi.charp2str(ll_source)
         res = _pypy_execute_source(source)
-        rffi.aroundstate.before()
+        before = rffi.aroundstate.before
+        if before: before()
         return rffi.cast(rffi.INT, res)
 
     @entrypoint('main', [], c_name='pypy_init_threads')
@@ -134,7 +136,8 @@
         if not space.config.objspace.usemodules.thread:
             return
         os_thread.setup_threads(space)
-        rffi.aroundstate.before()
+        before = rffi.aroundstate.before
+        if before: before()
 
     @entrypoint('main', [], c_name='pypy_thread_attach')
     def pypy_thread_attach():
@@ -145,7 +148,8 @@
         rthread.gc_thread_start()
         os_thread.bootstrapper.nbthreads += 1
         os_thread.bootstrapper.release()
-        rffi.aroundstate.before()
+        before = rffi.aroundstate.before
+        if before: before()
 
     w_globals = space.newdict()
     space.setitem(w_globals, space.wrap('__builtins__'),


More information about the pypy-commit mailing list