Author: Armin Rigo <[email protected]>
Branch: cffi-static-callback-embedding
Changeset: r81525:db64914878b9
Date: 2016-01-02 10:37 +0000
http://bitbucket.org/pypy/pypy/changeset/db64914878b9/

Log:    Fixes. Yay! The cffi tests (after translation) pass.

diff --git a/pypy/module/_cffi_backend/embedding.py 
b/pypy/module/_cffi_backend/embedding.py
--- a/pypy/module/_cffi_backend/embedding.py
+++ b/pypy/module/_cffi_backend/embedding.py
@@ -54,7 +54,9 @@
         name = rffi.charp2str(init_struct.name)
         #
         space = glob.space
+        must_leave = False
         try:
+            must_leave = space.threadlocals.try_enter_thread(space)
             load_embedded_cffi_module(space, version, init_struct)
             res = 0
         except OperationError, operr:
@@ -67,6 +69,8 @@
                 sys.stderr.write('sys.path: %r\n' % (sys.path,))
             """)
             res = -1
+        if must_leave:
+            space.threadlocals.leave_thread(space)
     except Exception, e:
         # oups! last-level attempt to recover.
         try:
@@ -110,7 +114,6 @@
 
     rpython_startup_code();
     RPyGilAllocate();
-    RPyGilRelease();
 
     if (dladdr(&_cffi_init, &info) == 0) {
         _cffi_init_error("dladdr() failed: ", dlerror());
diff --git a/rpython/rlib/entrypoint.py b/rpython/rlib/entrypoint.py
--- a/rpython/rlib/entrypoint.py
+++ b/rpython/rlib/entrypoint.py
@@ -120,9 +120,6 @@
                                       _nowrapper=True,
                                       random_effects_on_gcobjs=True)
 
-@entrypoint_lowlevel('main', [], c_name='rpython_startup_code')
+@entrypoint_highlevel('main', [], c_name='rpython_startup_code')
 def rpython_startup_code():
-    rffi.stackcounter.stacks_counter += 1
-    llop.gc_stack_bottom(lltype.Void)   # marker for trackgcroot.py
     RPython_StartupCode()
-    rffi.stackcounter.stacks_counter -= 1
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to