diff options
author | R David Murray <rdmurray@bitdance.com> | 2013-04-28 11:08:27 -0400 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2013-04-28 11:08:27 -0400 |
commit | ae3dbb9b279701ee8378123ac74f2f5d59b2c377 (patch) | |
tree | 30e8b2105a17dc98a78e98a0730d3235557a8c9c /Python/pystate.c | |
parent | 62e6455f78c85d5fa1c983a499ab089bd22e2c4e (diff) | |
parent | 519ad453b3624294a5c7664208d3a4f8ac353cdc (diff) | |
download | cpython-ae3dbb9b279701ee8378123ac74f2f5d59b2c377.tar.gz |
Merge #7152: Clarify that ProxyHandler is added only if proxy settings are detected.
Behavior confirmation and initial patch by Jessica McKellar.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index cfd61d0098..70038936d6 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -697,6 +697,15 @@ PyGILState_GetThisThreadState(void) return (PyThreadState *)PyThread_get_key_value(autoTLSkey); } +int +PyGILState_Check(void) +{ + /* can't use PyThreadState_Get() since it will assert that it has the GIL */ + PyThreadState *tstate = (PyThreadState*)_Py_atomic_load_relaxed( + &_PyThreadState_Current); + return tstate && (tstate == PyGILState_GetThisThreadState()); +} + PyGILState_STATE PyGILState_Ensure(void) { |