Commit Graph

213 Commits

Author SHA1 Message Date
Victor Stinner 06ddd35f5f Issue #25911: Backport os._DummyDirEntry fixes
* Fix test_os.BytesWalkTests on Windows
* Mimick better the reference os.DirEntry on Windows
* _DummyDirEntry now caches os.stat() result
* _DummyDirEntry constructor now tries to get os.stat()
* Fix os._DummyDirEntry.is_symlink(), don't follow symbolic links:
  use os.stat(path, follow_symlinks=False).
2016-03-29 13:38:22 +02:00
Serhiy Storchaka e14c07e4e4 Fixed a bug in os.walk() with bytes path on Windows caused by merging fixes
for issues #25995 and #25911.
2016-02-24 13:03:54 +02:00
Serhiy Storchaka 06c45e6e9c Issue #25995: os.walk() no longer uses FDs proportional to the tree depth. 2016-02-11 13:29:28 +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
Georg Brandl 306336bcda Closes #15161: add support for giving path as a fd for truncate() and pathconf(). 2012-06-24 12:55:33 +02:00
Larry Hastings b698d8e7e9 Issue #15154: Add "dir_fd" parameter to os.rmdir, remove "rmdir"
parameter from os.remove / os.unlink.
Patch written by Georg Brandl.  (I'm really looking forward to George
getting commit privileges so I don't have to keep doing checkins on his
behalf.)
2012-06-23 16:55:07 -07:00
Larry Hastings dbbc0c8bb3 Issue #14626: Fix buildbot issue on OpenIndiana 3.x machines. (Hopefully.) 2012-06-22 19:50:21 -07:00
Larry Hastings 9cf065cfdc Issue #14626: Large refactoring of functions / parameters in the os module.
Many functions now support "dir_fd" and "follow_symlinks" parameters;
some also support accepting an open file descriptor in place of of a path
string.  Added os.support_* collections as LBYL helpers.  Removed many
functions only previously seen in 3.3 alpha releases (often starting with
"f" or "l", or ending with "at").  Originally suggested by Serhiy Storchaka;
implemented by Larry Hastings.
2012-06-22 16:30:09 -07:00
Jesus Cea 9436361e4c Closes #10142: Support for SEEK_HOLE/SEEK_DATA 2012-06-22 18:32:07 +02:00
Gregory P. Smith 2d7d56abf8 Revert the modification of e.strerror in 3.2 as that kind of change could
break someone's over specified test that depends on the exact error message.
2012-06-03 14:39:26 -07:00
Gregory P. Smith f0a9a9b502 Fixes Issue #14992: os.makedirs(path, exist_ok=True) would raise an OSError
when the path existed and had the S_ISGID mode bit set when it was
not explicitly asked for.  This is no longer an exception as mkdir
cannot control if the OS sets that bit for it or not.
2012-06-03 14:35:09 -07:00
Gregory P. Smith a81c856436 Fixes Issue #14992: os.makedirs(path, exist_ok=True) would raise an OSError
when the path existed and had the S_ISGID mode bit set when it was not
explicitly asked for.  This is no longer an exception as mkdir cannot control
if the OS sets that bit for it or not.
2012-06-03 14:30:44 -07:00