Commit graph

702 commits

Author SHA1 Message Date
Victor Stinner
afe1706457 Issue #15478: Use source filename in OSError, not destination filename
And other fixes for Windows:

 * rename, replace and link require arguments of the same type on Windows
 * readlink only supports unicode filenames on Windows
 * os.open() specifies the filename on OSError
2012-10-31 22:47:43 +01:00
Victor Stinner
b024e84597 Issue #15478: Use path_error() in more posix functions, especially in Windows
implementation
2012-10-31 22:24:06 +01:00
Victor Stinner
266f882dca Issue #15478: Fix compilation on Windows 2012-10-30 02:27:11 +01:00
Victor Stinner
292c835548 Issue #15478: Raising an OSError doesn't decode or encode the filename anymore
Pass the original filename argument to OSError constructor, instead of trying
to encode it to or decode it from the filesystem encoding. This change avoids
an additionnal UnicodeDecodeError on Windows if the filename cannot be decoded
from the filesystem encoding (ANSI code page).
2012-10-30 02:17:38 +01:00
Petri Lehtinen
d25b3982c7 Replace tabs with spaces in posixmodule.c 2012-10-23 16:31:06 +03:00
Petri Lehtinen
5445a8cb41 Replace tabs with spaces in posixmodule.c 2012-10-23 16:29:59 +03:00
Antoine Pitrou
06eecead03 Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle.
Patch by Atsuo Ishimoto.
2012-10-21 16:33:33 +02:00
Jesus Cea
ab70e2ab32 #16135: Removal of OS/2 support (posixmodule y platform dependent files) 2012-10-05 01:48:08 +02:00
Christian Heimes
3b9493b53c Use C-style comments for C89 / ANSI C compatibility 2012-09-23 16:11:15 +02:00
Trent Nelson
9a46105a89 #15965: Explicitly cast AT_FDCWD as (int).
Required on Solaris 10 (which defines AT_FDCWD as 0xffd19553),
harmless on other platforms.
2012-09-18 21:50:06 -04:00
Antoine Pitrou
9d20e0edd9 Issue #15926: Fix crash after multiple reinitializations of the interpreter. 2012-09-12 18:01:36 +02:00
Antoine Pitrou
848698727f Issue #12655: Instead of requiring a custom type, os.sched_getaffinity and
os.sched_setaffinity now use regular sets of integers to represent the
CPUs a process is restricted to.
2012-08-04 16:16:35 +02:00
Jesus Cea
5323173dee Closes #15514: Correct __sizeof__ support for cpu_set 2012-08-03 14:18:11 +02:00
Antoine Pitrou
f3923e9dd7 Issue #15413: os.times() had disappeared under Windows. 2012-07-24 21:23:53 +02:00
Richard Oudkerk
2240ac1eae Issue #15261: Stop os.stat(fd) crashing on Windows when fd not open. 2012-07-06 12:05:32 +01:00
Victor Stinner
591c1cca32 Remove dead code
os.urandom() has now one unique implementation, posix_urandom() which
calls _PyOS_URandom(). _PyOS_URandom() uses RAND_pseudo_bytes() on VMS.
2012-06-28 01:45:48 +02:00
Georg Brandl
969288e488 Use ValueError, not RuntimeError for a utime flag combination illegal on some systems. 2012-06-26 09:25:44 +02:00
Larry Hastings
fdaea06d3c Issue #15176: Clarified behavior, documentation, and implementation
of os.listdir().
2012-06-25 04:42:23 -07:00
Georg Brandl
f78755968a Whitespace cleanup. 2012-06-24 13:58:31 +02:00
Larry Hastings
605a62ddb1 Issue #15118: Change return value of os.uname() and os.times() from
plain tuples to immutable iterable objects with named attributes
(structseq objects).
2012-06-24 04:33:36 -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
Georg Brandl
5bb7aa986e Try to fix shutil.which() tests on Windows by fixing a typo introduced in 27f9c26fdd8b in posix_access(). 2012-06-23 12:48:40 +02: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
67cbf7bff9 Issue #14626: Fix buildbot issue on x86 Tiger 3.x. 2012-06-22 17:06:48 -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
Victor Stinner
034d0aa217 Issue #14711: os.stat_float_times() has been deprecated. 2012-06-05 01:22:15 +02:00
Benjamin Peterson
9242c1378f capitialize utime statuses 2012-05-25 10:26:47 -07:00
Benjamin Peterson
eaa5eeef57 Backed out changeset 709850f1ec67 2012-05-05 21:22:14 -04:00
Larry Hastings
cfe6f2af3c Update Misc/NEWS for issues #14127 and #14705. (And, technically, #10148.) 2012-05-05 17:39:09 -07:00
Stefan Krah
6b03f2ce45 Fix typo in exception message. 2012-05-05 22:37:05 +02:00
Benjamin Peterson
fbd85a0fbf initialization not needed 2012-05-04 11:06:09 -04:00
Richard Oudkerk
f072b45e34 Fix for fatal errors in os.*utime*()
The address of an object was being decreffed instead of the object.
2012-05-04 12:01:31 +01:00
Larry Hastings
b333640aba Issue #14127: Fix two bugs with the Windows implementation. 2012-05-04 02:31:57 -07:00
Benjamin Peterson
9bd9d74996 what is a invalid tuple? 2012-05-04 01:42:41 -04:00
Benjamin Peterson
b399ab2c5c clean up converted path on error 2012-05-04 01:31:13 -04:00
Benjamin Peterson
3e2e368f3b avoid unitialized memory 2012-05-04 01:14:03 -04:00
Benjamin Peterson
35a8f0dee5 check correct variable for error 2012-05-04 01:10:59 -04:00
Larry Hastings
76ad59b7e8 Issue #14127: Add ns= parameter to utime, futimes, and lutimes.
Removed futimens as it is now redundant.
Changed shutil.copystat to use st_atime_ns and st_mtime_ns from os.stat
and ns= parameter to utime--it once again preserves exact metadata on Linux!
2012-05-03 00:30:07 -07:00
Jesus Cea
990eff0776 Backing out 86dc014cdd74. Not ready yet 2012-04-26 17:05:31 +02:00
Jesus Cea
2b47f0a23f Close #10142: Support for SEEK_HOLE/SEEK_DATA 2012-04-26 16:39:35 +02:00
Jesus Cea
1d642d2af1 Closes Issue #14661: posix module: add O_EXEC, O_SEARCH, O_TTY_INIT (I add some Solaris constants too) 2012-04-24 20:59:17 +02:00
Jesus Cea
cf381206fc Issue #14661: posix module: add O_EXEC, O_SEARCH, O_TTY_INIT 2012-04-24 20:44:40 +02:00
Larry Hastings
6fe20b3aee Issue #14127: Add st_{cma}time_ns fields to os.stat() result object. 2012-04-19 15:07:49 -07:00
Benjamin Peterson
2dbda07a17 fix condition (#14296) 2012-03-16 10:12:55 -05:00
Benjamin Peterson
7b51b8de38 try to fix compilation on glibc's with cpu sets (#14296) 2012-03-14 22:28:25 -05:00
Victor Stinner
5d272cc6a2 Close #14180: Factorize code to convert a number of seconds to time_t, timeval or timespec
time.ctime(), gmtime(), time.localtime(), datetime.date.fromtimestamp(),
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
raises an OverflowError, instead of a ValueError, if the timestamp does not fit
in time_t.

datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
round microseconds towards zero instead of rounding to nearest with ties going
away from zero.
2012-03-13 13:35:55 +01:00
Brett Cannon
efb00c0cc1 Issue #14153 Create _Py_device_encoding() to prevent _io from having to import
the os module.
2012-02-29 18:31:31 -05:00
Georg Brandl
2fb477c0f0 Merge 3.2: Issue #13703 plus some related test suite fixes. 2012-02-21 00:33:36 +01:00