mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
gh-128360: Add _Py_AssertHoldsTstate
as assertion for holding a thread state (#128361)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
c6b570e5e3
commit
4d0a6595a0
11 changed files with 48 additions and 32 deletions
|
@ -110,6 +110,7 @@ Local naming conventions:
|
|||
#include "pycore_fileutils.h" // _Py_set_inheritable()
|
||||
#include "pycore_moduleobject.h" // _PyModule_GetState
|
||||
#include "pycore_time.h" // _PyTime_AsMilliseconds()
|
||||
#include "pycore_pystate.h" // _Py_AssertHoldsTstate()
|
||||
#include "pycore_pyatomic_ft_wrappers.h"
|
||||
|
||||
#ifdef _Py_MEMORY_SANITIZER
|
||||
|
@ -822,8 +823,8 @@ internal_select(PySocketSockObject *s, int writing, PyTime_t interval,
|
|||
struct timeval tv, *tvp;
|
||||
#endif
|
||||
|
||||
/* must be called with the GIL held */
|
||||
assert(PyGILState_Check());
|
||||
/* must be called with a thread state */
|
||||
_Py_AssertHoldsTstate();
|
||||
|
||||
/* Error condition is for output only */
|
||||
assert(!(connect && !writing));
|
||||
|
@ -936,8 +937,8 @@ sock_call_ex(PySocketSockObject *s,
|
|||
int deadline_initialized = 0;
|
||||
int res;
|
||||
|
||||
/* sock_call() must be called with the GIL held. */
|
||||
assert(PyGILState_Check());
|
||||
/* sock_call() must be called with a thread state. */
|
||||
_Py_AssertHoldsTstate();
|
||||
|
||||
/* outer loop to retry select() when select() is interrupted by a signal
|
||||
or to retry select()+sock_func() on false positive (see above) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue