mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Close #24784: Fix compilation without thread support
Add "#ifdef WITH_THREAD" around cals to: * PyGILState_Check() * _PyImport_AcquireLock() * _PyImport_ReleaseLock()
This commit is contained in:
parent
647dac9d6f
commit
92f0113701
3 changed files with 18 additions and 2 deletions
|
@ -986,8 +986,10 @@ _Py_open_impl(const char *pathname, int flags, int gil_held)
|
|||
int
|
||||
_Py_open(const char *pathname, int flags)
|
||||
{
|
||||
#ifdef WITH_THREAD
|
||||
/* _Py_open() must be called with the GIL held. */
|
||||
assert(PyGILState_Check());
|
||||
#endif
|
||||
return _Py_open_impl(pathname, flags, 1);
|
||||
}
|
||||
|
||||
|
@ -1080,7 +1082,9 @@ _Py_fopen_obj(PyObject *path, const char *mode)
|
|||
wchar_t wmode[10];
|
||||
int usize;
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
assert(PyGILState_Check());
|
||||
#endif
|
||||
|
||||
if (!PyUnicode_Check(path)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
|
@ -1108,7 +1112,9 @@ _Py_fopen_obj(PyObject *path, const char *mode)
|
|||
PyObject *bytes;
|
||||
char *path_bytes;
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
assert(PyGILState_Check());
|
||||
#endif
|
||||
|
||||
if (!PyUnicode_FSConverter(path, &bytes))
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue