summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-42237: Fix os.sendfile() on illumos (GH-23154)Miss Islington (bot)2020-11-121-0/+15
| | | | | (cherry picked from commit fd4ed57674c675e05bd5d577dd5047a333c76c78) Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
* bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)Miss Islington (bot)2020-09-161-3/+2
| | | | | | | | | | I just realized that my recent PR with sendfile on Solaris ([PR 22040](https://github.com/python/cpython/pull/22040)) has broken error handling. Sorry for that, this simple followup fixes that. Automerge-Triggered-By: @1st1 (cherry picked from commit fa8c9e70104b0aef966a518eb3a80a4881906ae0) Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
* [3.9] bpo-41687: Fix sendfile implementation to work with Solaris (GH-22040) ↵Łukasz Langa2020-09-161-0/+19
| | | | | | | (GH-22273) (cherry picked from commit 8c0be6fd9101746235b63ddfb84106d1e9ca286b) Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
* bpo-40653: Move _dirnameW out of #ifdef HAVE_SYMLINK/#endif (GH-20144)Minmin Gong2020-05-181-2/+6
|
* bpo-40549: posixmodule.c uses defining_class (GH-20075)Victor Stinner2020-05-141-81/+97
| | | | | | | | | Pass PEP 573 defining_class to os.DirEntry methods. The module state is now retrieve from defining_class rather than Py_TYPE(self), to support subclasses (even if DirEntry doesn't support subclasses yet). * Pass the module rather than defining_class to DirEntry_fetch_stat(). * Only get the module state once in _posix_clear(), _posix_traverse() and _posixmodule_exec().
* bpo-40549: Convert posixmodule.c to multiphase init (GH-19982)Victor Stinner2020-05-101-117/+134
| | | | | | | | | | | | | | | Convert posixmodule.c ("posix" or "nt" module) to the multiphase initialization (PEP 489). * Create the module using PyModuleDef_Init(). * Create ScandirIteratorType and DirEntryType with the new PyType_FromModuleAndSpec() (PEP 573) * Get the module state from ScandirIteratorType and DirEntryType with the new PyType_GetModule() (PEP 573) * Pass module to functions which access the module state. * convert_sched_param() gets a new module parameter. It is now called directly since Argument Clinic doesn't support passing the module to an argument converter callback. * Remove _posixstate_global macro.
* bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820)Victor Stinner2020-05-011-3/+4
| | | | | | | | | An isolated subinterpreter cannot spawn threads, spawn a child process or call os.fork(). * Add private _Py_NewInterpreter(isolated_subinterpreter) function. * Add isolated=True keyword-only parameter to _xxsubinterpreters.create(). * Allow again os.fork() in "non-isolated" subinterpreters.
* bpo-38061: os.closerange() uses closefrom() on FreeBSD (GH-19696)Victor Stinner2020-04-241-7/+20
| | | | | | | | | On FreeBSD, os.closerange(fd_low, fd_high) now calls closefrom(fd_low) if fd_high is greater than or equal to sysconf(_SC_OPEN_MAX). Initial patch by Ed Maste (emaste), Conrad Meyer (cem), Kyle Evans (kevans) and Kubilay Kocak (koobs): https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242274
* bpo-40138: Fix Windows os.waitpid() for large exit code (GH-19637)Victor Stinner2020-04-221-6/+29
| | | | | | | | Fix the Windows implementation of os.waitpid() for exit code larger than "INT_MAX >> 8". The exit status is now interpreted as an unsigned number. os.waitstatus_to_exitcode() now accepts wait status larger than INT_MAX.
* bpo-40178: Convert the remaining os functions to Argument Clinic. (GH-19360)Serhiy Storchaka2020-04-181-124/+157
| | | | | Convert os.getgrouplist(), os.initgroups(), os.sendfile() and os.get_terminal_size().
* bpo-40268: Reformat posixmodule.c includes (GH-19536)Victor Stinner2020-04-151-172/+166
|
* bpo-40268: Remove unused osdefs.h includes (GH-19532)Victor Stinner2020-04-151-3/+3
| | | When the include is needed, add required symbol in a comment.
* bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner2020-04-151-4/+4
| | | | | | If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
* bpo-40268: Remove explicit pythread.h includes (#19529)Victor Stinner2020-04-151-1/+0
| | | | Remove explicit pythread.h includes: it is always included by Python.h.
* bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)Victor Stinner2020-04-141-1/+1
|
* bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)Victor Stinner2020-04-141-7/+7
| | | | | | | Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET() for consistency with _PyThreadState_GET() and to have a shorter name (help to fit into 80 columns). Add also "assert(tstate != NULL);" to the function.
* bpo-39481: Make os.DirEntry generic (GH-19415)Batuhan Taşkaya2020-04-071-0/+2
|
* bpo-40089: Add _at_fork_reinit() method to locks (GH-19195)Victor Stinner2020-04-071-1/+2
| | | | | | | | | | | | | | | Add a private _at_fork_reinit() method to _thread.Lock, _thread.RLock, threading.RLock and threading.Condition classes: reinitialize the lock after fork in the child process; reset the lock to the unlocked state. Rename also the private _reset_internal_locks() method of threading.Event to _at_fork_reinit(). * Add _PyThread_at_fork_reinit() private function. It is excluded from the limited C API. * threading.Thread._reset_internal_locks() now calls _at_fork_reinit() on self._tstate_lock rather than creating a new Python lock object.
* bpo-40190: Add support for _SC_AIX_REALMEM in sysconf (GH-19380)Batuhan Taşkaya2020-04-051-0/+3
|
* bpo-40094: Add os.waitstatus_to_exitcode() (GH-19201)Victor Stinner2020-04-011-0/+79
| | | | | | | | | | | | | | Add os.waitstatus_to_exitcode() function to convert a wait status to an exitcode. Suggest waitstatus_to_exitcode() usage in the documentation when appropriate. Use waitstatus_to_exitcode() in: * multiprocessing, os, subprocess and _bootsubprocess modules; * test.support.wait_process(); * setup.py: run_command(); * and many tests.
* bpo-40014: Fix os.getgrouplist() (GH-19126)Victor Stinner2020-03-241-22/+25
| | | | | | | | Fix os.getgrouplist(): if getgrouplist() function fails because the group list is too small, retry with a larger group list. On failure, the glibc implementation of getgrouplist() sets ngroups to the total number of groups. For other implementations, double the group list size.
* bpo-40014: Fix os.getgrouplist() on macOS (GH-19118)Victor Stinner2020-03-231-0/+19
| | | | | On macOS, getgrouplist() returns a non-zero value without setting errno if the group list is too small. Double the list size and call it again in this case.
* bpo-39968: Convert extension modules' macros of get_module_state() to inline ↵Hai Shi2020-03-161-43/+50
| | | | functions (GH-19017)
* bpo-39947: Use _PyInterpreterState_GET_UNSAFE() (GH-18978)Victor Stinner2020-03-131-7/+7
| | | | | | | Replace _PyInterpreterState_Get() function call with _PyInterpreterState_GET_UNSAFE() macro which is more efficient but don't check if tstate or interp is NULL. _Py_GetConfigsAsDict() now uses _PyThreadState_GET().
* bpo-39573: Use Py_IS_TYPE() macro to check for types (GH-18809)Andy Lester2020-03-061-2/+1
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-39184: Add audit events to functions in `fcntl`, `msvcrt`, `os`, ↵Saiyang Gou2020-02-131-17/+134
| | | | `resource`, `shutil`, `signal`, `syslog` (GH-18407)
* bpo-39184: Add audit events to command execution functions in os and pty ↵Saiyang Gou2020-02-051-7/+42
| | | | modules (GH-17824)
* bpo-39395: putenv() and unsetenv() always available (GH-18135)Victor Stinner2020-01-241-79/+4
| | | | | | | | The os.putenv() and os.unsetenv() functions are now always available. On non-Windows platforms, Python now requires setenv() and unsetenv() functions to build. Remove putenv_dict from posixmodule.c: it's not longer needed.
* bpo-39413: Implement os.unsetenv() on Windows (GH-18163)Victor Stinner2020-01-241-38/+69
| | | The os.unsetenv() function is now also available on Windows.
* bpo-39406: Implement os.putenv() with setenv() if available (GH-18128)Victor Stinner2020-01-221-18/+20
| | | | | If setenv() C function is available, os.putenv() is now implemented with setenv() instead of putenv(), so Python doesn't have to handle the environment variable memory.
* bpo-39406: os.putenv() avoids putenv_dict on Windows (GH-18126)Victor Stinner2020-01-221-2/+6
| | | | Windows: _wputenv(env) copies the *env* string and doesn't require the caller to manage the variable memory.
* Revert "bpo-39413: Implement os.unsetenv() on Windows (GH-18104)" (GH-18124)Victor Stinner2020-01-221-45/+1
| | | This reverts commit 56cd3710a1ea3ba872d345ea1bebc86ed08bc8b8.
* bpo-39406: Add PY_PUTENV_DICT macro to posixmodule.c (GH-18106)Victor Stinner2020-01-211-15/+37
| | | Rename posix_putenv_garbage to putenv_dict.
* bpo-39413: Implement os.unsetenv() on Windows (GH-18104)Victor Stinner2020-01-211-1/+43
| | | | | The os.unsetenv() function is now also available on Windows. It is implemented with SetEnvironmentVariableW(name, NULL).
* bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428)Benoit Hudson2019-12-061-5/+5
| | | | | | | | | | On most platforms, the `environ` symbol is accessible everywhere. In a dylib on OSX, it's not easily accessible, you need to find it with _NSGetEnviron. The code was caching the *value* of environ. But a setenv() can change the value, leaving garbage at the old value. Fix: don't cache the value of environ, just read it every time.
* closes bpo-38803: Fix leak in posixmodule. (GH-17373)Eddie Elizondo2019-11-261-0/+1
|
* closes bpo-38713: Expose P_PIDFD in os if it's defined. (GH-17071)Benjamin Peterson2019-11-061-0/+6
| | | https://bugs.python.org/issue38713
* bpo-38692: Add os.pidfd_open. (GH-17063)Benjamin Peterson2019-11-061-0/+25
|
* bpo-35381 Remove all static state from posixmodule (GH-15892)Eddie Elizondo2019-11-051-224/+271
| | | | | | | | | | | | | | After #9665, this moves the remaining types in posixmodule to be heap-allocated to make it compatible with PEP384 as well as modifying all the type accessors to fully make the type opaque. The original PR that got messed up a rebase: https://github.com/python/cpython/pull/10854. All the issues in that commit have now been addressed since https://github.com/python/cpython/pull/11661 got committed. This change also removes any state from the data segment and onto the module state itself. https://bugs.python.org/issue35381 Automerge-Triggered-By: @encukou
* bpo-38493: Add os.CLD_KILLED and os.CLD_STOPPED. (GH-16821)Dong-hee Na2019-10-211-0/+6
|
* bpo-38418: Fixes audit event for os.system to be named 'os.system' (GH-16670)Steve Dower2019-10-181-2/+2
| | | | | | | https://bugs.python.org/issue38418 Automerge-Triggered-By: @zooba
* bpo-38378: Rename parameters "out" and "in" of os.sendfile(). (GH-16742)Serhiy Storchaka2019-10-131-11/+10
| | | | | | | They conflicted with keyword "in". Also rename positional-only parameters of private os._fcopyfile() for consistency.
* closes bpo-36161: Use thread-safe ttyname_r instead of ttyname. (GH-14868)Antonio Gutierrez2019-10-091-4/+15
| | | Signed-off-by: Antonio Gutierrez <chibby0ne@gmail.com>
* bpo-38265: Update os.pread to accept the length type as Py_ssize_t. (GH-16359)Dong-hee Na2019-09-251-4/+3
|
* bpo-37206: Unrepresentable default values no longer represented as None. ↵Serhiy Storchaka2019-09-141-7/+5
| | | | | | | (GH-13933) In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all.
* bpo-32592: Set Windows 8 as the minimum required version for API support ↵Steve Dower2019-09-111-2/+0
| | | | (GH-15951)
* bpo-33166: Change os.cpu_count to return active (real) processors (GH-15949)Steve Dower2019-09-111-17/+3
|
* bpo-38110: Use fdwalk for os.closerange() when available. (GH-15224)Jakub Kulík2019-09-111-0/+25
| | | Use fdwalk() on platforms that support it to implement os.closerange().
* bpo-36279: Ensure os.wait3() rusage is initialized (GH-15111)Zackery Spytz2019-09-091-0/+6
| | | Co-Authored-By: David Wilson <dw@botanicus.net>
* bpo-38030: Fix os.stat failures on block devices on Windows (GH-15681)Steve Dower2019-09-041-6/+13
|