Commit Graph

221 Commits

Author SHA1 Message Date
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
Brett Cannon 5f74ebc2e4 Fix some PEP 8 violations. 2016-06-09 14:29:25 -07:00
Ethan Furman 228c636908 issue27186: fix fsencode/fsdecode and update tests; patch by Jelle Zijlstra 2016-06-04 13:47:39 -07:00
Ethan Furman 958b3e4058 issue27186: add PathLike ABC 2016-06-04 12:49:35 -07:00
Ethan Furman 410ef8e230 issue27186: add C version of os.fspath(); patch by Jelle Zijlstra 2016-06-04 12:06:26 -07:00
Ethan Furman c1cbeedf0c issue27182: update fsencode and fsdecode for os.path(); patch by Dusty Phillips 2016-06-04 10:19:27 -07:00
Ethan Furman cdc0879d3a issue27186 -- initial docs, tests, and python version of os.fspath 2016-06-02 15:06:09 -07:00
Victor Stinner 73030df77f Fix os._DummyDirEntry.is_symlink()
Issue #25911: Fix os._DummyDirEntry.is_symlink(), don't follow symbolic links:
use os.stat(path, follow_symlinks=False).
2016-03-29 11:25:00 +02:00
Victor Stinner ba8b0a7db4 Enhance os._DummyDirEntry
Issue #25911:

* Try to fix test_os.BytesWalkTests on Windows
* Try to mimick better the reference os.DirEntry on Windows
* _DummyDirEntry now caches os.stat() result
* _DummyDirEntry constructor now tries to get os.stat()
2016-03-24 12:23:18 +01:00
Serhiy Storchaka 7c90a82a01 Issue #25995: os.walk() no longer uses FDs proportional to the tree depth.
Different solution from 3.5.
2016-02-11 13:31:00 +02: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 5f6a0b4eb2 Issue #25911: Restored support of bytes paths in os.walk() on Windows. 2016-02-08 16:23:28 +02:00
Serhiy Storchaka 0bddc9eb15 Issue #25860: os.fwalk() no longer skips remaining directories when error occurs.
Original patch by Samson Lee.
2015-12-23 00:08:24 +02:00
Martin Panter 97cabb9fa5 Issue #25583: Merge makedirs fix from 3.4 into 3.5 2015-11-20 02:35:46 +00:00
Martin Panter a82642f9db Issue #25583: Avoid incorrect errors raised by os.makedirs(exist_ok=True) 2015-11-19 04:48:44 +00:00
Benjamin Peterson cd1aa9158e merge 3.4 (#23929) 2015-04-13 20:25:11 -04:00
Benjamin Peterson 52a3b74900 remove useless word (closes #23929) 2015-04-13 20:24:10 -04:00
Victor Stinner 5fdde71cce Issue #23605: Fix typo in an os.walk() comment
Thanks Ben Hoyt for the report.
2015-03-30 11:54:05 +02:00
Victor Stinner 7fea974baf Issue #23605: Fix os.walk(topdown=True), don't cache entry.is_symlink() because
the caller can replace the directory with a different file kind.

The bottom-up way, os.walk(topdown=False), still uses entry.is_symlink(), and
so can be faster than Python 3.4.
2015-03-18 11:29:47 +01:00
Victor Stinner 411bf641d3 Issue #23605: os.walk() doesn't need to call entry.is_symlink() if followlinks
is True
2015-03-12 09:12:48 +01:00
Victor Stinner 524a5ba111 Issue #23605: os.walk() now calls os.scandir() instead of os.listdir().
The usage of os.scandir() reduces the number of calls to os.stat().
Initial patch written by Ben Hoyt.
2015-03-10 13:20:34 +01:00
Yury Selivanov 97e2e06af8 os: Include posix functions in os.__all__. Closes issue #18554.
Patch by Ronald Oussoren.
2014-09-26 12:33:06 -04:00
Ned Deily 5c867018f0 Issue #21875: Remove vestigial references to Classic Mac OS in os module docs. 2014-06-26 23:40:06 -07:00
Benjamin Peterson e58e0c7f33 clarify when the list of subdirectories is read (closes #13779) 2014-06-15 20:51:12 -07:00
Benjamin Peterson 9dc203fff9 merge 3.3 (#21082) 2014-04-01 19:18:48 -04:00
Benjamin Peterson 4717e2112b merge 3.2 (#21082) 2014-04-01 19:17:57 -04:00
Benjamin Peterson ee5f1c13d1 remove directory mode check from makedirs (closes #21082) 2014-04-01 19:13:18 -04:00
Zachary Ware a22ae21db6 Fix parameter name in docs for os.makedirs and os.removedirs.
Pointed out by Colin Davis on docs@.
2014-03-20 09:42:01 -05:00
Christian Heimes f1dc3ee16d Issue #19218: Rename collections.abc to _collections_abc in order to speed up interpreter start 2013-10-13 02:04:20 +02:00
Christian Heimes 2582762b1b Issue #19209: Remove import of copyreg from the os module to speed up
interpreter startup. stat_result and statvfs_result are now hard-coded to
reside in the os module.
The patch is based on Victor Stinner's patch.
2013-10-12 01:27:08 +02:00
Victor Stinner a93c6db68b (Merge 3.3) Close #17702: On error, os.environb now removes suppress the except
context when raising a new KeyError with the original key.
2013-08-23 19:23:42 +02:00
Victor Stinner 0c2dd0c0a9 Close #17702: On error, os.environb now removes suppress the except context
when raising a new KeyError with the original key.
2013-08-23 19:19:15 +02:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Richard Oudkerk c41917f4cb Correction for 4f82b6cfee46. 2013-05-07 14:36:51 +01:00
Richard Oudkerk ad34ef8640 Fix os.__all__ to is passes test___all__ 2013-05-07 14:23:42 +01:00
Victor Stinner 43aa0d07e2 (Merge 3.3) Close #17702: os.environ now raises KeyError with the original
environment variable name (str on UNIX), instead of using the encoded name
(bytes on UNIX).
2013-04-14 16:38:35 +02:00
Victor Stinner 6d10139d70 Close #17702: os.environ now raises KeyError with the original environment
variable name (str on UNIX), instead of using the encoded name (bytes on UNIX).
2013-04-14 16:35:04 +02:00
Giampaolo Rodola' 0166a283f6 modernize some modules' code by replacing OSError->ENOENT/ENOTDIR/EPERM/EEXIST occurrences with the corresponding pep-3151 exceptions (FileNotFoundError, NotADirectoryError, etc.) 2013-02-12 15:14:17 +01:00
Serhiy Storchaka 1a03ac832d Issue #15845: Fix comparison between bytes and string.
Patch by Alessandro Moura.
2013-01-08 11:38:45 +02:00
Serhiy Storchaka f6fb3a3206 Issue #15845: Fix comparison between bytes and string. 2013-01-08 11:36:54 +02:00
Serhiy Storchaka 4ab23bfbeb Issue #15845: Fix comparison between bytes and string. 2013-01-08 11:32:58 +02:00
Andrew Svetlov 2552bc0601 fix typo (#16720) 2012-12-24 21:47:24 +02:00
Andrew Svetlov 8b33dd8e54 Use OESeeror instead of os.error (#16720)
Patch by Serhiy Storchaka.
2012-12-24 19:58:48 +02:00
Andrew Svetlov ad28c7f9da Issue #16706: get rid of os.error 2012-12-18 22:02:39 +02:00
Benjamin Peterson 29e02a2be8 merge 3.3 2012-10-09 11:16:13 -04:00
Benjamin Peterson b29614e047 compare singletons by identity not equality (closes #16712)
Patch from Serhiy Storchaka.
2012-10-09 11:16:03 -04:00
Jesus Cea 4791a24268 #16135: Removal of OS/2 support (Python code partial cleanup) 2012-10-05 03:15:39 +02:00
Larry Hastings b40380667c Issue #15202: Consistently use the name "follow_symlinks" for
new parameters in os and shutil functions.  Patch by Serhiy Storchaka.
2012-07-15 10:57:38 -07:00
Larry Hastings c48fe98a7c Issue #15177: Added dir_fd parameter to os.fwalk(). 2012-06-25 04:49:05 -07:00