diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-10-11 07:54:42 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-10-11 07:54:42 (GMT) |
commit | bc5b80bac1d3db5779fcace4922bfc7eb8b964fa (patch) | |
tree | f2683edb7faa3a850b6a387bdc52166af5525e55 /Python/fileutils.c | |
parent | b16e12aaaa3d6b3f47dc1400e900c2d4aae0f337 (diff) | |
download | cpython-bc5b80bac1d3db5779fcace4922bfc7eb8b964fa.zip cpython-bc5b80bac1d3db5779fcace4922bfc7eb8b964fa.tar.gz cpython-bc5b80bac1d3db5779fcace4922bfc7eb8b964fa.tar.bz2 |
Close #24784: Fix compilation without thread support
Add "#ifdef WITH_THREAD" around cals to:
* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r-- | Python/fileutils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c index bccd321..079918c 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -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; |