summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* closes bpo-34862: Guard definition of convert_sched_param with ↵William Orr2018-10-021-4/+6
| | | | | | POSIX_SPAWN_SETSCHEDULER. (GH-9658) Fixes broken build on OpenBSD-current.
* bpo-32557: allow shutil.disk_usage to take a file path on Windows also (GH-9372)Joe Pamer2018-09-251-2/+27
| | | https://bugs.python.org/issue32557
* bpo-33721: Make some os.path functions and pathlib.Path methods be tolerant ↵Serhiy Storchaka2018-09-181-4/+14
| | | | | | | | | | to invalid paths. (#7695) Such functions as os.path.exists(), os.path.lexists(), os.path.isdir(), os.path.isfile(), os.path.islink(), and os.path.ismount() now return False instead of raising ValueError or its subclasses UnicodeEncodeError and UnicodeDecodeError for paths that contain characters or bytes unrepresentative at the OS level.
* Convert os.readlink() to Argument Clinic. (GH-8778)Serhiy Storchaka2018-09-171-83/+71
| | | Also convert os.get_blocking() and os.set_blocking().
* bpo-34651: Only allow the main interpreter to fork. (gh-9279)Eric Snow2018-09-141-0/+14
| | | | | When os.fork() is called (on platforms that support it) all threads but the current one are destroyed in the child process. Consequently we must ensure that all but the associated interpreter are likewise destroyed. The main interpreter is critical for runtime operation, so we must ensure that fork only happens in the main interpreter. https://bugs.python.org/issue34651
* bpo-34674: Assume unistd.h exists on Unix. (GH-9290)Benjamin Peterson2018-09-141-35/+0
|
* bpo-31577: Fix a crash in os.utime() in case of a bad ns argument. (GH-3752)Oren Milman2018-09-121-0/+6
|
* closes bpo-34646: Remove PyAPI_* macros from declarations. (GH-9218)Benjamin Peterson2018-09-121-2/+2
|
* bpo-20104: Change the file_actions parameter of os.posix_spawn(). (GH-6725)Serhiy Storchaka2018-09-081-4/+5
| | | | | * Make its default value an empty tuple instead of None. * Make it a keyword-only parameter.
* bpo-20104: Add flag capabilities to posix_spawn (GH-6693)Pablo Galindo2018-09-071-4/+136
| | | Implement the "attributes objects" parameter of `os.posix_spawn` to complete the implementation and fully cover the underlying API.
* bpo-34384: Fix os.readlink() on Windows (GH-8740)Berker Peksag2018-08-151-59/+34
| | | | | | | | | os.readlink() now accepts path-like and bytes objects on Windows. Previously, support for path-like and bytes objects was only implemented on Unix. This commit also merges Unix and Windows implementations of os.readlink() in one function and adds basic unit tests to increase test coverage of the function.
* bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)Victor Stinner2018-08-031-4/+4
| | | | sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
* bpo-33871: Fix os.sendfile(), os.writev(), os.readv(), etc. (GH-7931)Serhiy Storchaka2018-07-311-17/+20
| | | | | | | | | | | | * Fix integer overflow in os.readv(), os.writev(), os.preadv() and os.pwritev() and in os.sendfile() with headers or trailers arguments (on BSD-based OSes and MacOS). * Fix sending the part of the file in os.sendfile() on MacOS. Using the trailers argument could cause sending more bytes from the input file than was specified. Thanks Ned Deily for testing on 32-bit MacOS.
* bpo-33671 / shutil.copyfile: use memoryview() with dynamic size on Windows ↵Giampaolo Rodola2018-06-191-2/+2
| | | | | | | | | | (#7681) bpo-33671 * use memoryview() with size == file size on Windows, see https://github.com/python/cpython/pull/7160#discussion_r195405230 * release intermediate (sliced) memoryview immediately * replace "OSX" occurrences with "macOS" * add some unittests for copyfileobj()
* bpo-33630: Fix using of freed memory in old versions of glicb for ↵Pablo Galindo2018-06-191-3/+22
| | | | posix_spawn(). (GH-7685)
* bpo-33671: efficient zero-copy for shutil.copy* functions (Linux, OSX and ↵Giampaolo Rodola2018-06-121-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Win) (#7160) * have shutil.copyfileobj use sendfile() if possible * refactoring: use ctx manager * add test with non-regular file obj * emulate case where file size can't be determined * reference _copyfileobj_sendfile directly * add test for offset() at certain position * add test for empty file * add test for non regular file dst * small refactoring * leave copyfileobj() alone in order to not introduce any incompatibility * minor refactoring * remove old test * update docstring * update docstring; rename exception class * detect platforms which only support file to socket zero copy * don't run test on platforms where file-to-file zero copy is not supported * use tempfiles * reset verbosity * add test for smaller chunks * add big file size test * add comment * update doc * update whatsnew doc * update doc * catch Exception * remove unused import * add test case for error on second sendfile() call * turn docstring into comment * add one more test * update comment * add Misc/NEWS entry * get rid of COPY_BUFSIZE; it belongs to another PR * update doc * expose posix._fcopyfile() for OSX * merge from linux branch * merge from linux branch * expose fcopyfile * arg clinic for the win implementation * convert path type to path_t * expose CopyFileW * fix windows tests * release GIL * minor refactoring * update doc * update comment * update docstrings * rename functions * rename test classes * update doc * update doc * update docstrings and comments * avoid do import nt|posix modules if unnecessary * set nt|posix modules to None if not available * micro speedup * update description * add doc note * use better wording in doc * rename function using 'fastcopy' prefix instead of 'zerocopy' * use :ref: in rst doc * change wording in doc * add test to make sure sendfile() doesn't get called aymore in case it doesn't support file to file copies * move CopyFileW in _winapi and actually expose CopyFileExW instead * fix line endings * add tests for mode bits * add docstring * remove test file mode class; let's keep it for later when Istart addressing OSX fcopyfile() specific copies * update doc to reflect new changes * update doc * adjust tests on win * fix argument clinic error * update doc * OSX: expose copyfile(3) instead of fcopyfile(3); also expose flags arg to python * osx / copyfile: use path_t instead of char * do not set dst name in the OSError exception in order to remain consistent with platforms which cannot do that (e.g. linux) * add same file test * add test for same file * have osx copyfile() pre-emptively check if src and dst are the same, otherwise it will return immedialtey and src file content gets deleted * turn PermissionError into appropriate SameFileError * expose ERROR_SHARING_VIOLATION in order to raise more appropriate SameFileError * honour follow_symlinks arg when using CopyFileEx * update Misc/NEWS * expose CreateDirectoryEx mock * change C type * CreateDirectoryExW actual implementation * provide specific makedirs() implementation for win * fix typo * skeleton for SetNamedSecurityInfo * get security info for src path * finally set security attrs * add unit tests * mimick os.makedirs() behavior and raise if dst dir exists * set 2 paths for OSError object * set 2 paths for OSError object * expand windows test * in case of exception on os.sendfile() set filename and filename2 exception attributes * set 2 filenames (src, dst) for OSError in case copyfile() fails on OSX * update doc * do not use CreateDirectoryEx() in copytree() if source dir is a symlink (breaks test_copytree_symlink_dir); instead just create a plain dir and remain consistent with POSIX implementation * use bytearray() and readinto() * use memoryview() with bytearray() * refactoring + introduce a new _fastcopy_binfileobj() fun * remove CopyFileEx and other C wrappers * remove code related to CopyFileEx * Recognize binary files in copyfileobj() ...and use fastest _fastcopy_binfileobj() when possible * set 1MB copy bufsize on win; also add a global _COPY_BUFSIZE variable * use ctx manager for memoryview() * update doc * remove outdated doc * remove last CopyFileEx remnants * OSX - use fcopyfile(3) instead of copyfile(3) ...as an extra safety measure: in case src/dst are "exotic" files (non regular or living on a network fs etc.) we better fail on open() instead of copyfile(3) as we're not quite sure what's gonna happen in that case. * update doc
* Remove unneeded PyErr_Occurred() check in os_lseek_impl() (GH-7557)Zackery Spytz2018-06-101-3/+0
| | | | | This call became unneeded after the posix module was converted to the Argument Clinic in 2f93635d342a500053e97c9c7c30f1eaf11fc3ac and should have been removed as part of that change.
* bpo-33441: Make the sigset_t converter available in other modules. (GH-6720)Serhiy Storchaka2018-05-081-0/+59
| | | | | | | | | * Expose the sigset_t converter via private API _Py_Sigset_Converter(). * Use Argument Clinic for parsing sigset_t in signalmodule.c. * Raise ValueError instead OverflowError for integers out of the C long range. Based on patch by Pablo Galindo Salgado.
* bpo-20104: Improve error handling and fix a reference leak in ↵Serhiy Storchaka2018-05-011-122/+123
| | | | os.posix_spawn(). (#6332)
* bpo-33016: Fix potential use of uninitialized memory in nt._getfinalpathname ↵Alexey Izbyshev2018-03-081-42/+32
| | | | (#6010)
* bpo-33001: Prevent buffer overrun in os.symlink (GH-5989)Steve Dower2018-03-051-28/+38
|
* bpo-32903: Fix a memory leak in os.chdir() on Windows (GH-5801)Alexey Izbyshev2018-03-011-7/+7
|
* bpo-32556: nt._getfinalpathname, nt._getvolumepathname and nt._getdiskusage ↵Steve Dower2018-02-221-33/+48
| | | | now correctly convert from bytes. (GH-5761)
* closes bpo-32859: Don't retry dup3() if it is not available at runtime (GH-5708)Alexey Izbyshev2018-02-201-1/+1
| | | | | | | | os.dup2() tests for dup3() system call availability at runtime, but doesn't remember the result across calls, repeating the test on each call with inheritable=False. Since the caller of os.dup2() is expected to hold the GIL, fix this by making the variable holding the test result static.
* Update comment in posixmodule.c (GH-5681)ngie-eign2018-02-141-1/+1
| | | | | A closing parentheses was missing. Signed-off-by: Ngie Cooper <yaneurabeya@gmail.com>
* bpo-29248: Fix os.readlink() on Windows (GH-5577)SSE42018-02-121-3/+3
| | | | The PrintNameOffset field of the reparse data buffer was treated as a number of characters instead of bytes.
* bpo-32747: Remove trailing spaces in docstrings. (GH-5491)oldk2018-02-021-1/+1
|
* bpo-32681: Fix an uninitialized variable in the C implementation of os.dup2 ↵Stéphane Wirtel2018-01-301-1/+1
| | | | | (GH-5346) See https://bugs.python.org/issue32441 for where this was introduced.
* bpo-20104: Fix leaks and errors in new os.posix_spawn (GH-5418)Pablo Galindo2018-01-291-52/+66
| | | | | | | | | | * Fix memory leaks and error handling in posix spawn * Improve error handling when destroying the file_actions object * Py_DECREF the result of PySequence_Fast on error * Handle uninitialized pid * Use OSError if file actions fails to initialize * Move _file_actions to outer scope to avoid undefined behaviour * Remove HAVE_POSIX_SPAWN define in Modules/posixmodule.c * Unshadow exception and clean error message
* bpo-32705: Current Android does not have posix_spawn (#5413)Chih-Hsuan Yen2018-01-291-0/+7
|
* bpo-20104: Expose `posix_spawn` in the os module (GH-5109)Pablo Galindo2018-01-291-1/+201
| | | | | Add os.posix_spawn to wrap the low level POSIX API of the same name. Contributed by Pablo Galindo.
* bpo-32659: Solaris "stat" should support "st_fstype" (#5307)jcea2018-01-281-0/+17
| | | | | | * bpo-32659: Solaris "stat" should support "st_fstype" * Add 'versionadded'
* bpo-31368: Expose preadv and pwritev in the os module (#5239)Pablo Galindo2018-01-271-0/+194
|
* bpo-32390: Fix compilation failure on AIX after f_fsid was added to ↵Michael Felt2018-01-051-0/+6
| | | | os.statvfs() (#4972)
* return the new file descriptor from os.dup2 (closes bpo-32441) (#5041)Benjamin Peterson2017-12-291-16/+27
|
* bpo-26439 Fix ctypes.util.find_library failure on AIX (#4507)Michael Felt2017-12-191-0/+3
| | | | | Implement find_library() support in ctypes/util for AIX. Add some AIX specific tests.
* bpo-32143: add f_fsid to os.statvfs() (#4571)Giuseppe Scrivano2017-12-141-0/+2
| | | Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* bpo-32277: Fix exception raised from chmod(..., follow_symlinks=False) (#4797)Anthony Sottile2017-12-141-0/+1
|
* bpo-16135: Cleanup: Code rot left over from OS/2 support (GH-4147)Erik Bray2017-10-271-5/+1
| | | | Remove dangling references to PYCC_VACPP that are not relelvant since removal of OS/2 support.
* bpo-30768: Recompute timeout on interrupted lock (GH-4103)Victor Stinner2017-10-241-3/+1
| | | | | | | | | | | | | | | | Fix the pthread+semaphore implementation of PyThread_acquire_lock_timed() when called with timeout > 0 and intr_flag=0: recompute the timeout if sem_timedwait() is interrupted by a signal (EINTR). See also the PEP 475. The pthread implementation of PyThread_acquire_lock() now fails with a fatal error if the timeout is larger than PY_TIMEOUT_MAX, as done in the Windows implementation. The check prevents any risk of overflow in PyThread_acquire_lock(). Add also PY_DWORD_MAX constant.
* bpo-31827: Remove os.stat_float_times() (GH-4061)Victor Stinner2017-10-241-44/+4
|
* os.startfile(): add a C comment on security (#3877)Victor Stinner2017-10-131-0/+4
| | | LoadLibrary("SHELL32") is not vulnerable to DLL hijacking.
* bpo-25658: Implement PEP 539 for Thread Specific Storage (TSS) API (GH-1362)Masayuki Yamamoto2017-10-061-3/+0
| | | | | | | | | See PEP 539 for details. Highlights of changes: - Add Thread Specific Storage (TSS) API - Document the Thread Local Storage (TLS) API as deprecated - Update code that used TLS API to use TSS API
* remove support for BSD/OS (closes bpo-31624) (#3812)Benjamin Peterson2017-09-291-1/+1
|
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-3/+1
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* bpo-31343: Include sys/sysmacros.h (#3318)Christian Heimes2017-09-051-0/+5
| | | | | | Include sys/sysmacros.h for major(), minor(), and makedev(). GNU C libray plans to remove the functions from sys/types.h. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-30581: Windows: os.cpu_count() returns wrong number of processors (#2934)Christopher Wilcox2017-08-301-3/+16
| | | | | | | | * Fixes #30581 by adding a path to use newer GetMaximumProcessorCount API on Windows calls to os.cpu_count() * Add NEWS.d entry for bpo-30581, os.cpu_count on Windows. * Tweak NEWS entry
* bpo-31106: Fix handling of erros in posix_fallocate() and posix_fadvise() ↵Коренберг Марк2017-08-141-10/+20
| | | | (#3000) (#3000)
* Spelling fixes (#2902)Ville Skyttä2017-08-031-1/+1
|
* bpo-30879: os.listdir() and os.scandir() now emit bytes names when (#2634)Serhiy Storchaka2017-07-111-3/+5
| | | | called with bytes-like argument.