title: How do you determine if a function holds the GIL?
body: <p>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? </p>
  
  <p>For example, I want to determine if the key derivation algorithms from <code>hashlib</code> hold the GIL? I thought I could use <code>time.time()</code> 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.</p>