How do you determine if a function holds the GIL?

1.5k views Asked by At

Is there a reliable way to test whether a function holds (doesn't release) the GIL through its entire execution? If so, what is that method?

For example, I want to determine if the key derivation algorithms from hashlib hold the GIL? I thought I could use time.time() to determine whether the GIL was held by checking if the difference between the time after the thread started to before was significantly large. But this option relies upon personal judgment and doesn't account for if both times were collected before the interpreter decided to execute the function in question.

0

There are 0 answers