summaryrefslogtreecommitdiffstats
path: root/Python/fileutils.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-29619: Convert st_ino using unsigned integer (#557)Victor Stinner2017-03-091-2/+2
| | | | bpo-29619: os.stat() and os.DirEntry.inodeo() now convert inode (st_ino) using unsigned integers.
* Issue #26919: On Android, operating system data is now always encoded/decodedXavier de Gaye2016-12-151-5/+5
| | | | | to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8.
* Issue #28746: Fix the set_inheritable() file descriptor method on platformsXavier de Gaye2016-11-191-1/+1
| | | | that do not have the ioctl FIOCLEX and FIONCLEX commands
* Fix check_force_ascii()Victor Stinner2016-09-101-8/+9
| | | | | Issue #27938: Normalize aliases of the ASCII encoding, because _Py_normalize_encoding() now correctly normalize encoding names.
* Issue #23524: Finish removing _PyVerify_fd from sourcesSteve Dower2016-09-081-124/+4
|
* Issue #27076: Merge spelling from 3.5Martin Panter2016-05-261-1/+1
|\
| * Issue #27076: Doc, comment and tests spelling fixesMartin Panter2016-05-261-1/+1
| | | | | | | | Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
* | Merge 3.5 (issue #27057)Victor Stinner2016-05-191-2/+7
|\ \ | |/
| * Fix os.set_inheritable() on AndroidVictor Stinner2016-05-191-2/+7
| | | | | | | | | | | | | | Issue #27057: Fix os.set_inheritable() on Android, ioctl() is blocked by SELinux and fails with EACCESS. The function now falls back to fcntl(). Patch written by Michał Bednarski.
* | Avoid fcntl() if possible in set_inheritable()Victor Stinner2016-04-171-5/+13
| | | | | | | | | | | | Issue #26770: set_inheritable() avoids calling fcntl() twice if the FD_CLOEXEC is already set/cleared. This change only impacts platforms using the fcntl() implementation of set_inheritable() (not Linux nor Windows).
* | Add more checks on the GILVictor Stinner2016-03-141-0/+16
|/ | | | | | | | | | | | Issue #10915, #15751, #26558: * PyGILState_Check() now returns 1 (success) before the creation of the GIL and after the destruction of the GIL. It allows to use the function early in Python initialization and late in Python finalization. * Add a flag to disable PyGILState_Check(). Disable PyGILState_Check() when Py_NewInterpreter() is called * Add assert(PyGILState_Check()) to: _Py_dup(), _Py_fstat(), _Py_read() and _Py_write()
* Fix a couple of typos in code commentsMartin Panter2015-12-171-2/+2
|
* Close #24784: Fix compilation without thread supportVictor Stinner2015-10-111-0/+6
| | | | | | | | Add "#ifdef WITH_THREAD" around cals to: * PyGILState_Check() * _PyImport_AcquireLock() * _PyImport_ReleaseLock()
* Issue #23524: Replace _PyVerify_fd function with calls to ↵Steve Dower2015-04-121-39/+56
| | | | _set_thread_local_invalid_parameter_handler.
* Issue #23836: Document functions releasing the GIL in fileutils.cVictor Stinner2015-04-011-3/+5
|
* Issue #23836: Add _Py_write_noraise() functionVictor Stinner2015-04-011-48/+83
| | | | | Helper to write() which retries write() if it is interrupted by a signal (fails with EINTR).
* Issue #23752: _Py_fstat() is now responsible to raise the Python exceptionVictor Stinner2015-03-301-11/+47
| | | | Add _Py_fstat_noraise() function when a Python exception is not welcome.
* Issue #23753: Move _Py_wstat() from Python/fileutils.c to Modules/getpath.cVictor Stinner2015-03-241-17/+0
| | | | | | | I expected more users of _Py_wstat(), but in practice it's only used by Modules/getpath.c. Move the function because it's not needed on Windows. Windows uses PC/getpathp.c which uses the Win32 API (ex: GetFileAttributesW()) not the POSIX API.
* Issue #23753: Python doesn't support anymore platforms without stat() orVictor Stinner2015-03-241-16/+0
| | | | | | | fstat(), these functions are always required. Remove HAVE_STAT and HAVE_FSTAT defines, and stop supporting DONT_HAVE_STAT and DONT_HAVE_FSTAT.
* Issue #23708: Save/restore errno in _Py_read() and _Py_write()Victor Stinner2015-03-201-15/+21
| | | | | Save and then restore errno because PyErr_CheckSignals() and PyErr_SetFromErrno() can modify it.
* Issue #23708: Split assertion expression in two assertions in _Py_read() andVictor Stinner2015-03-201-2/+4
| | | | _Py_write() to know which test failed on the buildbot "AMD64 Snow Leop 3.x".
* Issue #23708: Fix _Py_read() compilation error on WindowsVictor Stinner2015-03-191-1/+1
| | | | Fix typo: self->fd => fd
* Issue #23708: Add _Py_read() and _Py_write() functions to factorize code handleVictor Stinner2015-03-191-0/+149
| | | | | | | | EINTR error and special cases for Windows. These functions now truncate the length to PY_SSIZE_T_MAX to have a portable and reliable behaviour. For example, read() result is undefined if counter is greater than PY_SSIZE_T_MAX on Linux.
* Issue #23694: Handle EINTR in _Py_open() and _Py_fopen_obj()Victor Stinner2015-03-181-13/+40
| | | | | Retry open()/fopen() if it fails with EINTR and the Python signal handler doesn't raise an exception.
* Issue #23694: Enhance _Py_fopen(), it now raises an exception on errorVictor Stinner2015-03-181-12/+36
| | | | | * If fopen() fails, OSError is raised with the original filename object. * The GIL is now released while calling fopen()
* Issue #23694: Enhance _Py_open(), it now raises exceptionsVictor Stinner2015-03-171-17/+55
| | | | | | | | * _Py_open() now raises exceptions on error. If open() fails, it raises an OSError with the filename. * _Py_open() now releases the GIL while calling open() * Add _Py_open_noraise() when _Py_open() cannot be used because the GIL is not held
* Fixes incorrect use of GetLastError where errno should be used.Steve Dower2015-03-141-6/+6
|\
| * Fixes incorrect use of GetLastError where errno should be used.Steve Dower2015-03-141-6/+6
| |
* | Issue #23524: Change back to using Windows errors for _Py_fstat instead of ↵Steve Dower2015-03-081-3/+5
| | | | | | | | the errno shim.
* | Issue #23524: Replace _PyVerify_fd function with calling ↵Steve Dower2015-03-061-5/+103
| | | | | | | | _set_thread_local_invalid_parameter_handler on every thread.
* | Issue #23152: Renames time_t_to_FILE_TIME to _Py_time_t_to_FILE_TIME, ↵Steve Dower2015-02-211-4/+2
| | | | | | | | removes unused struct win32_stat and return value
* | Issue #23152: Renames attribute_data_to_stat to _Py_attribute_data_to_statSteve Dower2015-02-211-2/+2
| |
* | Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on ↵Steve Dower2015-02-211-2/+140
| | | | | | | | | | | | Windows. fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
* | merge 3.4 (#23165)Benjamin Peterson2015-01-041-3/+13
|\ \ | |/
| * merge 3.3 (closes #23165)Benjamin Peterson2015-01-041-3/+13
| |\
| | * merge 3.2 (closes #23165)Benjamin Peterson2015-01-041-3/+13
| | |\
| | | * add some overflow checks before multiplying (closes #23165)Benjamin Peterson2015-01-041-3/+13
| | | |
* | | | (Merge 3.4) Closes #22258: Fix the the internal function set_inheritable() onVictor Stinner2014-09-021-14/+34
|\ \ \ \ | |/ / / | | | | | | | | | | | | | | | | Illumos. This platform exposes the function ioctl(FIOCLEX), but calling it fails with errno is ENOTTY: "Inappropriate ioctl for device". set_inheritable() now falls back to the slower fcntl() (F_GETFD and then F_SETFD).
| * | | Closes #22258: Fix the the internal function set_inheritable() on Illumos.Victor Stinner2014-09-021-14/+34
| | | | | | | | | | | | | | | | | | | | | | | | This platform exposes the function ioctl(FIOCLEX), but calling it fails with errno is ENOTTY: "Inappropriate ioctl for device". set_inheritable() now falls back to the slower fcntl() (F_GETFD and then F_SETFD).
* | | | Issue #18395: Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, renameVictor Stinner2014-08-011-32/+35
| | | | | | | | | | | | | | | | | | | | ``_Py_wchar2char()`` to :c:func:`Py_EncodeLocale`, and document these functions.
* | | | Issue #22054: Add os.get_blocking() and os.set_blocking() functions to get andVictor Stinner2014-07-291-0/+53
|/ / / | | | | | | | | | | | | set the blocking mode of a file descriptor (False if the O_NONBLOCK flag is set, True otherwise). These functions are not available on Windows.
* | | Merge from 3.3.Stefan Krah2014-01-201-1/+2
|\ \ \ | |/ /
| * | Issue #19036: Including locale.h should not depend on HAVE_LANGINFO_H.Stefan Krah2014-01-201-1/+2
| | |
* | | (Merge 3.3) fileutils.c: use MAXPATHLEN instead of PATH_MAXVictor Stinner2013-11-151-6/+6
|\ \ \ | |/ / | | | | | | PATH_MAX is not declared on IRIX nor Windows.
| * | fileutils.c: use MAXPATHLEN instead of PATH_MAXVictor Stinner2013-11-151-6/+6
| | | | | | | | | | | | PATH_MAX is not declared on IRIX nor Windows.
| * | (Merge 3.2) Issue #16455: On FreeBSD and Solaris, if the locale is C, theVictor Stinner2013-01-031-23/+217
| |\ \ | | |/ | | | | | | | | | | | | | | | ASCII/surrogateescape codec is now used, instead of the locale encoding, to decode the command line arguments. This change fixes inconsistencies with os.fsencode() and os.fsdecode() because these operating systems announces an ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
| | * Issue #16455: On FreeBSD and Solaris, if the locale is C, theVictor Stinner2013-01-031-23/+222
| | | | | | | | | | | | | | | | | | | | | ASCII/surrogateescape codec is now used, instead of the locale encoding, to decode the command line arguments. This change fixes inconsistencies with os.fsencode() and os.fsdecode() because these operating systems announces an ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
| | * Issue #16416: Fix compilation errorVictor Stinner2012-12-031-1/+3
| | |
| * | (Merge 3.2) Issue #16416: On Mac OS X, operating system data are now alwaysVictor Stinner2012-12-031-6/+54
| |\ \ | | |/ | | | | | | | | | | | | | | | encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding (which may be ASCII if no locale environment variable is set), to avoid inconsistencies with os.fsencode() and os.fsdecode() functions which are already using UTF-8/surrogateescape.
| | * Issue #16416: On Mac OS X, operating system data are now alwaysVictor Stinner2012-12-031-6/+54
| | | | | | | | | | | | | | | | | | | | | encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding (which may be ASCII if no locale environment variable is set), to avoid inconsistencies with os.fsencode() and os.fsdecode() functions which are already using UTF-8/surrogateescape.