Skip to content

Commit

Permalink
Py_AddPendingCall instead of messing with the GIL.
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelmc committed Sep 3, 2017
1 parent 601ea48 commit d9cd6ef
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/hunter/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,11 @@ def gdb_bootstrap(args, activation_payload, deactivation_payload):
print('WARNING: Using GDB may deadlock the process or create unpredictable results!')
activation_command = [
'gdb', '-p', str(args.pid), '-batch',
'-ex', 'call PyGILState_Ensure()',
'-ex', 'call PyRun_SimpleString(%s)' % json.dumps(activation_payload),
'-ex', 'call PyGILState_Release($1)',
'-ex', 'call Py_AddPendingCall(PyRun_SimpleString, %s)' % json.dumps(activation_payload),
]
deactivation_command = [
'gdb', '-p', str(args.pid), '-batch',
'-ex', 'call PyGILState_Ensure()',
'-ex', 'call PyRun_SimpleString(%s)' % json.dumps(deactivation_payload),
'-ex', 'call PyGILState_Release($1)',
'-ex', 'call Py_AddPendingCall(PyRun_SimpleString, %s)' % json.dumps(deactivation_payload),
]
check_call(activation_command)
try:
Expand Down

0 comments on commit d9cd6ef

Please sign in to comment.