Commit Graph

1009 Commits

Author SHA1 Message Date
Martin Panter b1321fba53 Issue #28394: More typo fixes for 3.6+ 2016-10-10 00:38:21 +00:00
Serhiy Storchaka 2674bc7229 Issue #27998: Fixed bytes path support in os.scandir() on Windows.
Patch by Eryk Sun.
2016-10-08 20:16:57 +03:00
Christian Heimes 6f3f3e5ca4 Increase buffer for readlink() in case OS will support longer names one day. 2016-09-23 20:24:39 +02:00
Christian Heimes 3cb091e576 Increase buffer for readlink() in case OS will support longer names one day. 2016-09-23 20:24:28 +02:00
Victor Stinner ec2319c46d Fix memleak in os.getrandom()
Issue #27778: Fix a memory leak in os.getrandom() when the getrandom() is
interrupted by a signal and a signal handler raises a Python exception.

Modify also os_getrandom_impl() to avoid the temporary buffer, use directly a
Python bytes object.
2016-09-20 23:00:59 +02:00
Victor Stinner 26c03bd7d5 Fix memory leak in path_converter()
Issue #28200: Replace PyUnicode_AsWideCharString() with
PyUnicode_AsUnicodeAndSize().
2016-09-19 11:55:44 +02:00
Berker Peksag bf3c1c3235 Issue #28075: Fix test_access_denied in Python 3.5
I forgot there two variations of os.stat() in Python 3.5.
2016-09-18 13:56:29 +03:00
Berker Peksag 052e4f18c4 Issue #28075: Merge from 3.5 2016-09-17 15:51:14 +03:00
Berker Peksag 0b4dc4846b Issue #28075: Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat()
Patch by Eryk Sun.
2016-09-17 15:49:59 +03:00
Berker Peksag 3940499ca8 Issue #28156: Export os.getpid() conditionally
Patch by Ed Schouten.
2016-09-15 20:45:16 +03:00
Berker Peksag 8181646931 Issue #28114: Fix a crash in parse_envlist() when env contains byte strings
Patch by Eryk Sun.
2016-09-15 20:19:47 +03:00
Steve Dower 654a7bdf57 Adds missing assert suppression. 2016-09-11 20:19:32 -07:00
Steve Dower 6230aaf561 Issue #27781: Fixes uninitialized fd when !MS_WINDOWS and !HAVE_OPENAT 2016-09-09 09:03:15 -07:00
Benjamin Peterson 768f3b4492 do not pretend to support passing a fd to access() 2016-09-05 15:29:33 -07:00
Benjamin Peterson 207116b84c use Py_MAX 2016-09-08 11:28:06 -07:00
Steve Dower 940f33a50f Issue #23524: Finish removing _PyVerify_fd from sources 2016-09-08 11:21:54 -07:00
Steve Dower 513d7478a1 Fix mismatched if blocks in posixmodule.c. 2016-09-08 10:41:50 -07:00
Steve Dower cc16be85c0 Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529) 2016-09-08 10:35:16 -07:00
Benjamin Peterson 840ef8f84b more linux -> __linux__ 2016-09-07 14:45:10 -07:00
Victor Stinner e66987e626 os.urandom() now blocks on Linux
Issue #27776: The os.urandom() function does now block on Linux 3.17 and newer
until the system urandom entropy pool is initialized to increase the security.

This change is part of the PEP 524.
2016-09-06 16:33:52 -07:00
Victor Stinner 9b1f474df6 Add os.getrandom()
Issue #27778: Expose the Linux getrandom() syscall as a new os.getrandom()
function.

This change is part of the PEP 524.
2016-09-06 16:18:52 -07:00
Victor Stinner 581139cb34 Run Argument Clinic on posixmodule.c
Issue #17884.
2016-09-06 15:54:20 -07:00
Benjamin Peterson ca47063998 replace Py_(u)intptr_t with the c99 standard types 2016-09-06 13:47:26 -07:00
Benjamin Peterson af580dff4a replace PY_LONG_LONG with long long 2016-09-06 10:46:49 -07:00
Benjamin Peterson ed4aa83ff7 require a long long data type (closes #27961) 2016-09-05 17:44:18 -07:00
Benjamin Peterson b1cb8b2872 merge 3.5 2016-09-05 15:35:45 -07:00
Brett Cannon 3f9183b5ac Issue #26027, #27524: Add PEP 519/__fspath__() support to os and
os.path.

Thanks to Jelle Zijlstra for the initial patch against posixmodule.c.
2016-08-26 14:44:48 -07:00
Ned Deily eb3be66b3a Issue #27736: Prevent segfault after interpreter re-initialization due
to ref count problem introduced in code for Issue #27038 in 3.6.0a3.
Patch by Xiang Zhang.
2016-08-15 14:40:38 -04:00
Serhiy Storchaka d73c31899e Issue #26800: Undocumented support of general bytes-like objects
as paths in os functions is now deprecated.
2016-08-06 23:22:08 +03:00
Martin Panter 70214ad55d Issue #17599: Use unique _Py_REPARSE_DATA_BUFFER etc names to avoid conflict
The conflict occurs with Min GW, which already defines REPARSE_DATA_BUFFER.
Also, Min GW uses a lowercase <windows.h> filename.
2016-08-04 02:38:59 +00:00
Benjamin Peterson bf5868d2c5 merge 3.5 (#27656) 2016-07-30 23:22:24 -07:00
Benjamin Peterson dbaa559b7f all SCHED_ constants are optional (closes #27656) 2016-07-30 23:21:50 -07:00
Steve Dower 262dc1e71d Issue #27533: Release GIL in nt._isdir 2016-07-17 20:50:28 -07:00
Steve Dower b22a67737e Issue #27533: Release GIL in nt._isdir 2016-07-17 20:49:38 -07:00
Brett Cannon 044283a426 Issue #27512: Don't segfault when os.fspath() calls an object whose
__fspath__() raises an exception.

Thanks to Xiang Zhang for the patch.
2016-07-15 10:41:49 -07:00
Serhiy Storchaka 2954f83999 - Issue #27332: Fixed the type of the first argument of module-level functions
generated by Argument Clinic.  Patch by Petr Viktorin.
2016-07-07 18:20:03 +03:00
Serhiy Storchaka 1a2b24f02d Issue #27332: Fixed the type of the first argument of module-level functions
generated by Argument Clinic.  Patch by Petr Viktorin.
2016-07-07 17:35:15 +03:00
Brett Cannon a32c4d0531 Issue #27038: Expose DirEntry as os.DirEntry.
Thanks to Jelle Zijlstra for the code portion of the patch.
2016-06-24 14:14:44 -07:00
Brett Cannon c78ca1e044 Issue #27186: Update os.fspath()/PyOS_FSPath() to check the return
type of __fspath__().

As part of this change, also make sure that the pure Python
implementation of os.fspath() is tested.
2016-06-24 12:03:43 -07:00
doko@ubuntu.com fcff437de3 - Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constants
exposed on the API which are not implemented on GNU/Hurd. They would not
  work at runtime anyway.
2016-06-13 16:33:04 +02:00
Brett Cannon 96881cd621 Issue #27186: Add os.PathLike support to DirEntry
Initial patch thanks to Jelle Zijlstra.
2016-06-10 14:37:21 -07:00
Brett Cannon b4f43e90d9 Clarify documentation for os.fspath(). 2016-06-09 14:32:08 -07:00
Ethan Furman 410ef8e230 issue27186: add C version of os.fspath(); patch by Jelle Zijlstra 2016-06-04 12:06:26 -07:00
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) 46833e73af Fix issue27146 - add stdio.h include to posixmodule.c for ctermid(). 2016-05-28 21:06:41 +00:00
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) fa76eeec70 Fix issue27146 - add stdio.h include to posixmodule.c for ctermid(). 2016-05-28 21:03:48 +00:00
Serhiy Storchaka deab18dfd0 Issue #26708: Use the "const" qualifier for immutable strings.
This can help to avoid unintentional modification.
2016-05-07 16:45:18 +03:00
Serhiy Storchaka c2f7d87897 Issue #26932: Fixed support of RTLD_* constants defined as enum values,
not via macros (in particular on Android).  Patch by Chi Hsuan Yen.
2016-05-04 09:44:44 +03:00
Stefan Krah fb7c8ae4e7 Issue #26863: HAVE_FACCESSAT should (currently) not be defined on Android. 2016-04-26 17:04:18 +02:00
Serhiy Storchaka 3291d85a2f Issue #26671: Fixed #ifdef indentation. 2016-04-06 23:02:46 +03:00
Serhiy Storchaka aaf553bac4 Backed out changeset 8dc144e47252 2016-04-06 23:02:25 +03:00
Serhiy Storchaka 026110f0a2 Issue #26671: Fixed #ifdef indentation. 2016-04-06 22:55:31 +03:00
Serhiy Storchaka 819399b2ab Issue #26671: Enhanced path_converter.
Exceptions raised during converting argument of correct type are no longer
overridded with TypeError. Some error messages are now more detailed.
2016-04-06 22:17:52 +03:00
Serhiy Storchaka ab479c49d3 Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:41:15 +03:00
Serhiy Storchaka fbb1c5ee06 Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:40:02 +03:00
Victor Stinner 7bfa409ff8 Implement finalizer for os.scandir() iterator
Issue #26603:

* Implement finalizer for os.scandir() iterator
* Set the source parameter when emitting the ResourceWarning warning
* Close the iterator before emitting the warning
2016-03-23 00:43:54 +01:00
Victor Stinner f664dc5834 ResourceWarning: Revert change on socket and scandir
io.FileIO has a safe implementation of destructor, but not socket nor scandir.
2016-03-19 02:01:48 +01:00
Victor Stinner 914cde89d4 On ResourceWarning, log traceback where the object was allocated
Issue #26567:

* Add a new function PyErr_ResourceWarning() function to pass the destroyed
  object
* Add a source attribute to warnings.WarningMessage
* Add warnings._showwarnmsg() which uses tracemalloc to get the traceback where
  source object was allocated.
2016-03-19 01:03:51 +01:00
Victor Stinner c36674a2c5 Fix usage of PyMem_Malloc() in os.stat()
Issue #26563: Replace PyMem_Malloc() with PyMem_RawMalloc() in the Windows
implementation of os.stat(), since the code is called without holding the GIL.
2016-03-16 14:30:16 +01:00
Victor Stinner c44f70770b posix_getcwd(): limit to INT_MAX on Windows
It's more to fix a conversion warning during compilation, I don't think that
Windows support current working directory larger than 2 GB ...
2016-03-14 18:07:53 +01:00
Serhiy Storchaka ffe96ae10b Issue #25994: Added the close() method and the support of the context manager
protocol for the os.scandir() iterator.
2016-02-11 13:21:30 +02:00
Serhiy Storchaka fd625c39d0 Issue #26117: The os.scandir() iterator now closes file descriptor not only
when the iteration is finished, but when it was failed with error.
2016-02-08 17:57:22 +02:00
Serhiy Storchaka 988b9bcd88 Issue #26117: The os.scandir() iterator now closes file descriptor not only
when the iteration is finished, but when it was failed with error.
2016-02-08 17:56:36 +02:00
Serhiy Storchaka ef1585eb9a Issue #25923: Added more const qualifiers to signatures of static and private functions. 2015-12-25 20:01:53 +02:00
Serhiy Storchaka 2d06e84455 Issue #25923: Added the const qualifier to static constant arrays. 2015-12-25 19:53:18 +02:00
Serhiy Storchaka 8bc2b4d522 Issue #25890: Removed yet one unused variable. 2015-12-18 10:06:58 +02:00
Serhiy Storchaka 9b3a2eec1c Issues #25890, #25891, #25892: Removed unused variables in Windows code.
Reported by Alexander Riccio.
2015-12-18 10:03:13 +02:00
Victor Stinner 9fdaff30db Merge 3.5 2015-12-14 00:22:10 +01:00
Victor Stinner e847d7170d Issue #25846: Fix usage of Py_ARRAY_LENGTH() in win32_wchdir() (new try) 2015-12-14 00:21:50 +01:00
Victor Stinner 6b8f0c892a (Merge 3.5) Issue #25846: Fix usage of Py_ARRAY_LENGTH() in win32_wchdir() 2015-12-13 21:41:12 +01:00
Victor Stinner ed53782ed5 Issue #25846: Fix usage of Py_ARRAY_LENGTH() in win32_wchdir() 2015-12-13 21:40:26 +01:00
Victor Stinner 5ebae87628 Issue #25207, #14626: Fix my commit.
It doesn't work to use #define XXX defined(YYY)" and then "#ifdef XXX"
to check YYY.
2015-09-22 01:29:33 +02:00
Victor Stinner 4552ced916 Issue #25207, #14626: Fix ICC compiler warnings in posixmodule.c
Replace "#if XXX" with #ifdef XXX".
2015-09-21 22:37:15 +02:00
Victor Stinner 024364a89a Merge 3.5 (os.waitpid) 2015-09-15 10:24:27 +02:00
Victor Stinner d3ffd32767 Issue #25118: Fix a regression of Python 3.5.0 in os.waitpid() on Windows.
Add an unit test on os.waitpid()
2015-09-15 10:11:03 +02:00
Martin Panter 3f560c16e5 Merge 3.5 into 3.6 2015-09-09 06:28:08 +00:00
Martin Panter 6088b7bd49 Merge 3.4 into 3.5 2015-09-09 06:27:43 +00:00
Martin Panter 9499413508 os.sendfile(headers=None, trailers=None) arguments are not actually accepted
Needs to be tested on a BSD.
2015-09-09 05:29:24 +00:00
Martin Panter a122b5a1fd Issue #23738: Merge 3.5 into 3.6 2015-09-09 03:01:17 +00:00
Martin Panter 0ff89099c7 Issue #23738: Merge 3.4 into 3.5 2015-09-09 01:56:53 +00:00
Martin Panter bf19d16950 Issue #23738: Document and test actual keyword parameter names
Also fix signature because os.utime(..., ns=None) is not allowed.
2015-09-09 01:01:13 +00:00
Serhiy Storchaka 56f6e76c68 Issue #15989: Fixed some scarcely probable integer overflows.
It is very unlikely that they can occur in real code for now.
2015-09-06 21:25:30 +03:00
Victor Stinner fed0931de4 Merge 3.5 (ICC) 2015-09-03 21:34:03 +02:00
Victor Stinner 5b6917e60d Merge 3.4 (ICC) 2015-09-03 21:32:44 +02:00
Victor Stinner 528a9ab1f0 Don't use defined() in C preprocessor macros
The ICC compiler doesn't seem to support defined() in macro expansion. Example
of warning:

warning #3199: "defined" is always false in a macro expansion in Microsoft mode
2015-09-03 21:30:26 +02:00
Charles-François Natali 80d62e628b Issue #23530: fix clinic comment. 2015-08-13 20:37:08 +01:00
Charles-François Natali dc87e4b885 Issue #23530: Improve os.cpu_count() description.
Patch by Julian Taylor.
2015-07-13 21:01:39 +01:00
Serhiy Storchaka f0b5015edb Converted os._getfullpathname() and os._isdir() to Argument Clinic. 2015-05-13 00:52:39 +03:00
Victor Stinner cc0bbbc781 (Merge 3.4) Issue #9246: On POSIX, os.getcwd() now supports paths longer than
1025 bytes. Patch written by William Orr.
2015-04-25 00:21:52 +02:00
Victor Stinner 4403d7def0 Issue #9246: On POSIX, os.getcwd() now supports paths longer than 1025 bytes
Patch written by William Orr.
2015-04-25 00:16:10 +02:00
Christian Heimes 8714cfdc4a Get rid of unused-but-set-variable warning. len and len2 should be equal and len2 is technically more correct, too. 2015-04-21 10:57:41 +02:00
Serhiy Storchaka 7e9d1d1a1b Issue #23908: os functions now reject paths with embedded null character
on Windows instead of silently truncate them.

Removed no longer used _PyUnicode_HasNULChars().
2015-04-20 10:12:28 +03:00
Serhiy Storchaka 2b0d2007a1 Issue #23908: os functions now reject paths with embedded null character
on Windows instead of silently truncate them.
2015-04-20 09:53:58 +03:00
Larry Hastings 89964c48d1 Issue #23944: Argument Clinic now wraps long impl prototypes at column 78. 2015-04-14 18:07:59 -04:00
Benjamin Peterson 5646de47e1 make DirEntryType and ScandirIteratorType static (closes #23918) 2015-04-12 17:56:34 -04:00
Steve Dower a1c7e727c8 Issue #23668: Suppresses invalid parameter handler around chsize calls. 2015-04-12 00:26:43 -04:00
Steve Dower 8fc8980c96 Issue #23524: Replace _PyVerify_fd function with calls to _set_thread_local_invalid_parameter_handler. 2015-04-12 00:26:27 -04:00
Steve Dower fe0a41aae4 Issue #23668: Adds support for os.truncate and os.ftruncate on Windows 2015-03-20 19:50:46 -07:00
Serhiy Storchaka a4c6badfdd Issue #23501: #include "clinic/posixmodule.c.h" was in the section skipped on Windows. 2015-04-04 23:35:52 +03:00
Serhiy Storchaka 1009bf18b3 Issue #23501: Argumen Clinic now generates code into separate files by default. 2015-04-03 23:53:51 +03:00
Larry Hastings 0759f84d62 Issue #23500: Argument Clinic is now smarter about generating the "#ifndef"
(empty) definition of the methoddef macro: it's only generated once, even
if Argument Clinic processes the same symbol multiple times, and it's emitted
at the end of all processing rather than immediately after the first use.
2015-04-03 13:09:02 -07:00