[issue34416] PyCapsule_Import seems to release the GIL without acquiring it

2018-08-17 Thread Brett Cannon
Brett Cannon added the comment: "From our discussion off the issue tracker, it seems that your contention is that any C API calls can arbitrarily release the GIL, and the calling function can not be said to "hold" the GIL. If this is true than this is not a bug and can be closed." Correct,

[issue34416] PyCapsule_Import seems to release the GIL without acquiring it

2018-08-17 Thread Paul Ganssle
Paul Ganssle added the comment: > It does not seem to me that two threads have the GIL at the same time. To be clear, this was never my contention. I was under the impression that if you take the GIL with PyGILState_Ensure(), the GIL was held until you called PyGILState_Release(), as with a

[issue34416] PyCapsule_Import seems to release the GIL without acquiring it

2018-08-16 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Summary of how I see this dump: 1) Thread 2 tries to get the GIL. 2) Thread 3 tries to get the GIL. 3 Gil acquired! (0) 4) Thread 2 drops the GIL, which means that thread 2 managed to get it before. 5) Gil acquired! (1) 6) Thread 2 tries to get the GIL.

[issue34416] PyCapsule_Import seems to release the GIL without acquiring it

2018-08-16 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- Removed message: https://bugs.python.org/msg323627 ___ Python tracker ___ ___ Python-bugs-list

[issue34416] PyCapsule_Import seems to release the GIL without acquiring it

2018-08-16 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Breaking in take_gil and drop_gil I get this trace: Thread 2 "gil" hit Breakpoint 1, 0x5559563d in acquire_gil () Thread 3 "gil" hit Breakpoint 1, 0x5559563d in acquire_gil () Waiting for GIL (0) Waiting for GIL (1) Thread 2 "gil" hit Br

[issue34416] PyCapsule_Import seems to release the GIL without acquiring it

2018-08-16 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Breaking in take_gil and drop_gil I get this trace: Thread 2 "gil" hit Breakpoint 1, 0x5559563d in acquire_gil () Thread 3 "gil" hit Breakpoint 1, 0x5559563d in acquire_gil () Waiting for GIL (0) Waiting for GIL (1) Thread 2 "gil" hit Br

[issue34416] PyCapsule_Import seems to release the GIL without acquiring it

2018-08-16 Thread Paul Ganssle
Paul Ganssle added the comment: Using a modified version of Python 3.7.0 that prints "Releasing GIL" whenever PyGILState_Release, I get this: Waiting for GIL (0) Gil acquired! (0) Waiting for GIL (1) Gil acquired! (1) Releasing GIL Gil released! (0) Releasing GIL Gil released! (1) So whateve

[issue34416] PyCapsule_Import seems to release the GIL without acquiring it

2018-08-16 Thread Eric N. Vander Weele
Change by Eric N. Vander Weele : -- nosy: +ericvw ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue34416] PyCapsule_Import seems to release the GIL without acquiring it

2018-08-16 Thread Paul Ganssle
New submission from Paul Ganssle : I was recently debugging some multithreaded Rust code that was deadlocking, and I tracked it down to what I'm fairly certain is a bug somewhere in PyCapsule_Import, where it seems that PyCapsule_Import releases the GIL without first acquiring it. I've attac