Skip to content

Commit

Permalink
don't use an additional flag to see if we updated the lua state and n…
Browse files Browse the repository at this point in the history
…eed to bring it back, just use NULL in case we did not
  • Loading branch information
jbinary committed Sep 17, 2016
1 parent 7764324 commit 58dcbb2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lupa/_lupa.pyx
Expand Up @@ -1399,21 +1399,19 @@ cdef bint call_python(LuaRuntime runtime, lua_State *L, py_object* py_obj) excep

cdef int py_call_with_gil(lua_State* L, py_object *py_obj) with gil:
cdef LuaRuntime runtime = None
cdef lua_State* stored_state
updated_state = False
cdef lua_State* stored_state = NULL

try:
runtime = <LuaRuntime?>py_obj.runtime
if runtime._state is not L:
updated_state = True
stored_state = runtime._state
runtime._state = L
return call_python(runtime, L, py_obj)
except:
try: runtime.store_raised_exception()
finally: return -1
finally:
if updated_state:
if stored_state is not NULL:
runtime._state = stored_state

cdef int py_object_call(lua_State* L) nogil:
Expand Down

0 comments on commit 58dcbb2

Please sign in to comment.