Commit Graph

817 Commits

Author SHA1 Message Date
Serhiy Storchaka 9101e23ff6 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:41:45 +02:00
Serhiy Storchaka 7898043868 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
2013-01-15 01:12:17 +02:00
Serhiy Storchaka c99b5120a7 Issue #15972: Fix error messages when os functions expecting a file name or
file descriptor receive the incorrect type.
2013-01-07 23:16:49 +02:00
Serhiy Storchaka a2ad5c3ad1 Issue #15972: Fix error messages when os functions expecting a file name or
file descriptor receive the incorrect type.
2013-01-07 23:13:46 +02:00
Serhiy Storchaka 404fa924c3 Issue #16841: Set st_dev on Windows as unsigned long to match its DWORD type. 2013-01-02 18:22:23 +02:00
Victor Stinner e4110dc11f Issue #9644: Fix the encoding used by os.statvfs(): use the filesystem encoding
with the surrogateescape error handler, instead of UTF-8 in strict mode.
2013-01-01 23:05:55 +01:00
Brian Curtin 9cc4321bf5 Backed out changeset 61bada808b34 2013-01-01 12:31:06 -06:00
Brian Curtin e3d0b65118 Set st_dev on Windows as unsigned long to match its DWORD type, related to the change to fix #11939. 2013-01-01 12:21:35 -06:00
Brian Curtin 87e63a273c st_dev/st_rdev should be unsigned long as dwVolumeSerialNumber, which it is set to, is a DWORD. This was fixed in #11939 and the overflow was mentioned in #10657 and seen by me on some machines. 2012-12-31 11:59:48 -06:00
Brian Curtin 490b32a397 Fix #11939. Set st_dev attribute on Windows to simplify os.path.samefile.
By setting the st_dev attribute, we can then remove some Windows-specific
code and move os.path.samefile/sameopenfile/samestat to Lib/genericpath.py
so all platforms share the same implementation.
2012-12-26 07:03:03 -06:00
Andrew Svetlov 2606a6f197 Issue #16719: Get rid of WindowsError. Use OSError instead
Patch by Serhiy Storchaka.
2012-12-19 14:33:35 +02:00
Andrew Svetlov a191959849 Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:27:16 +02:00
Andrew Svetlov 5b89840d9c Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:26:36 +02:00
Andrew Svetlov 737fb89dd1 Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:14:22 +02:00
Victor Stinner 4e7d2d481a Issue #15478: Oops, fix regression in os.open() on Windows
os.open() uses _wopen() which sets errno, not the Windows error code.
2012-11-05 01:20:58 +01:00
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
Georg Brandl 09a7c72cad Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 21:31:46 +01:00
Georg Brandl 2daf6ae249 Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime)
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.

The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 19:54:16 +01:00
Antoine Pitrou bcf2b59fb5 Issue #13609: Add two functions to query the terminal size:
os.get_terminal_size (low level) and shutil.get_terminal_size (high level).
Patch by Zbigniew Jędrzejewski-Szmek.
2012-02-08 23:28:36 +01:00
Victor Stinner 4195b5caea Backout f8409b3d6449: the PEP 410 is not accepted yet 2012-02-08 23:03:19 +01:00
Victor Stinner ccd5715a14 PEP 410 2012-02-08 14:31:50 +01:00
Victor Stinner 1aa54a417d Issue #13964: Skip os.*utime*() tests if os.stat() doesn't support timestamp
with a subsecond resolution
2012-02-08 04:09:37 +01:00
Victor Stinner a2f7c00638 Issue #13964: Split os.*utime*() subsecond tests into multiple tests to help
debugging
2012-02-08 03:36:25 +01:00
Charles-François Natali 7794090251 Following Nick's suggestion, rename posix.fdlistdir() to posix.flistdir(), to
be consistent with other functions accepting file descriptors (fdlistdir() was
added in 3.3, so hasn't been released yet).
2012-02-06 19:54:48 +01:00
Antoine Pitrou f3b2d88b67 Issue #8828: Add new function os.replace(), for cross-platform renaming with overwriting. 2012-01-30 22:08:52 +01:00
Antoine Pitrou 91ecea24f5 Issue #13772: In os.symlink() under Windows, do not try to guess the link
target's type (file or directory).  The detection was buggy and made the
call non-atomic (therefore prone to race conditions).
2012-01-24 09:05:18 +01:00
Antoine Pitrou 5311c1d7ab Issue #13772: In os.symlink() under Windows, do not try to guess the link
target's type (file or directory).  The detection was buggy and made the
call non-atomic (therefore prone to race conditions).
2012-01-24 08:59:28 +01:00
Martin v. Löwis 50590f111b Use GetModuleHandleW to avoid *A functions where possible. 2012-01-14 17:54:09 +01:00
Victor Stinner e83f899364 Issue #13530: Document os.lseek() result
Patch written by Jérémy Anger.
2011-12-17 23:15:09 +01:00
Charles-François Natali 76961faaa0 Issue #13757: Change os.fdlistdir() so that it duplicates the passed file
descriptor (instead of closing it).
2012-01-10 20:25:09 +01:00
Charles-François Natali f2840a8890 Backed out changeset 36f2e236c601: For some reason, rewinddir() doesn't work as
it should on OpenIndiana.
2012-01-08 20:30:47 +01:00
Charles-François Natali 38f425e475 Issue #13739: It's simpler and more direct to call rewinddir() at the
beginning.
2012-01-08 19:07:18 +01:00
Charles-François Natali 7546ad327d Issue #13739: In os.listdir(), rewind the directory stream (so that listdir()
can be called again on the same open file).
2012-01-08 18:34:06 +01:00
Victor Stinner 25ec056cc2 Issue #13530: Document os.lseek() result
Patch written by Jérémy Anger.
2011-12-17 23:15:22 +01:00
Victor Stinner 1b57967b96 Issue #13560: Locale codec functions use the classic "errors" parameter,
instead of surrogateescape

So it would be possible to support more error handlers later.
2011-12-17 05:47:23 +01:00
Victor Stinner 1f33f2b0c3 Issue #13560: os.strerror() now uses the current locale encoding instead of UTF-8 2011-12-17 04:45:09 +01:00
Victor Stinner 984890fcbb Close #13415: Test in configure if unsetenv() has a return value or not.
Patch written by Charles-François Natali.
2011-11-24 13:53:38 +01:00
Benjamin Peterson e8eb0e82f3 merge 3.2 2011-11-22 23:14:47 -06:00
Benjamin Peterson 4bb867d3ec plug refleak 2011-11-22 23:12:49 -06:00
Victor Stinner 65170954e0 (Merge 3.2) Issue #13415: os.unsetenv() doesn't ignore errors anymore. 2011-11-22 22:16:17 +01:00
Victor Stinner 60b385e813 Issue #13415: os.unsetenv() doesn't ignore errors anymore. 2011-11-22 22:01:28 +01:00
Victor Stinner f8facacf30 Fix compiler warnings 2011-11-22 02:30:47 +01:00
Victor Stinner 9d3b93ba30 Use the new Unicode API
* Replace PyUnicode_FromUnicode(NULL, 0) by PyUnicode_New(0, 0)
 * Replce PyUnicode_FromUnicode(str, len) by PyUnicode_FromWideChar(str, len)
 * Replace Py_UNICODE by wchar_t
 * posix_putenv() uses PyUnicode_FromFormat() to create the string, instead
   of PyUnicode_FromUnicode() + _snwprintf()
2011-11-22 02:27:30 +01:00
Victor Stinner f7c5ae2257 Issue #13374: Deprecate os.getcwdb() on Windows 2011-11-16 23:43:07 +01:00
Victor Stinner 1ab6c2d2c2 Issue #13374: The Windows bytes API has been deprecated in the os module. Use
Unicode filenames instead of bytes filenames to not depend on the ANSI code
page anymore and to support any filename.
2011-11-15 22:27:41 +01:00
Victor Stinner 6139c1bfa3 Issue #12442: nt._getdiskusage() is now using the Windows Unicode API 2011-11-09 22:14:14 +01:00
Jesus Cea d03a49150f Commit 59dca1e2363d for issue #13327 introduced a compilation warning 2011-11-08 17:28:04 +01:00
Brian Curtin 569b494320 Fix #13327. utimensat now has the atime and mtime arguments set as optional,
defaulting to None like the other utimes family members. It now accepts
keyword arguments because, unlike other other functions in the family,
it has a `flags` value at the end of the argument list (which
retains its 0 default).
2011-11-07 16:09:20 -06:00
Brian Curtin 7ef53ef916 Forgot to apply the futimesat change. 2011-11-07 14:38:24 -06:00
Brian Curtin c1b65d1831 Fix 13327. Remove explicit None arguments from futimes, futimens, futimesat,
and lutimes.
2011-11-07 14:18:54 -06:00
Brian Curtin b0d5b5d3b2 Adjust None handling to be a bit more clean. Thanks to Benjamin
for pointing it out.
2011-11-07 10:51:18 -06:00
Brian Curtin 52fbea1d87 Fix #13327. Remove the need for an explicit None as the second argument to
os.utime in order to update to the current time. The second argument is now
optional.
2011-11-06 13:41:17 -06:00
Ross Lagerwall ab1078b987 (Merge 3.2) Issue #13339. 2011-11-04 07:15:35 +02:00
Ross Lagerwall dcfde5aac9 Issue #13339: Fix compile error in posixmodule.c due to missing semicolon.
Thanks to Robert Xiao.
2011-11-04 07:09:14 +02:00
Victor Stinner 8b905bd9d4 Issue #13226: Add RTLD_xxx constants to the os module. These constants can by
used with sys.setdlopenflags().
2011-10-25 13:34:04 +02:00
Martin v. Löwis bd928fef42 Rename _Py_identifier to _Py_IDENTIFIER. 2011-10-14 10:20:37 +02:00
Victor Stinner beac78bb24 Use PyUnicode_AsUnicodeAndSize() instead of PyUnicode_GET_SIZE() 2011-10-11 21:55:01 +02:00
Martin v. Löwis 1ee1b6fe0d Use identifier API for PyObject_GetAttrString. 2011-10-10 18:11:30 +02:00
Victor Stinner 034f6cf10c Add PyUnicode_Copy() function, include it to the public API 2011-09-30 02:26:44 +02:00
Victor Stinner eb5657a0c5 posix module catches PyUnicode_AsUnicode() failure
* Replace PyUnicode_AS_UNICODE by PyUnicode_AsUnicode, PyUnicode_AS_UNICODE is
   no more a real macro
 * Replace Py_UNICODE by wchar_t in code specific to Windows
2011-09-30 01:44:27 +02:00
Victor Stinner 639418812f Use the new Py_ARRAY_LENGTH macro 2011-09-29 00:42:28 +02:00
Victor Stinner 6fa6777503 os.statvfs() encodes the filename to the filesystem encoding 2011-09-20 04:04:33 +02:00
Ross Lagerwall b1e5d595af Issue #12517: Silence warning on windows buildbots (from 7fd80c61ddaa). 2011-09-19 08:30:43 +02:00
Benjamin Peterson 9428d53eb4 only compile xattrs on glibc (closes #12720) 2011-09-14 11:45:52 -04:00
Benjamin Peterson b77fe17320 Use xattr functions from sys/xattr.h instead of attr/xattr.h (closes #12720)
sys/xattr.h is glibc while attr/xattr.h is a separate library.
2011-09-13 17:20:47 -04:00
Jesus Cea 54b01498e3 Typo 2011-09-10 01:53:19 +02:00
Jesus Cea 9c82227277 Yet another fix for #12763: test_posix failure on OpenIndiana 2011-09-10 01:40:52 +02:00
Jesus Cea f2cb4e8b35 Close issue 12952: Solaris/Illumos (OpenIndiana) Scheduling policies 2011-09-09 23:55:42 +02:00
Larry Hastings 9e3e70b331 Issue #12904: os.utime, os.futimes, os.lutimes, and os.futimesat now write
atime and mtime with nanosecond precision on modern POSIX platforms.
2011-09-08 19:29:07 -07:00
Charles-François Natali ea0d5fcb4a Issue #12871: sched_get_priority_(min|max) might not be defined even though
<sched.h> is available (most notably on OpenBSD when built without pthread):
add an explicit configure check.
2011-09-06 19:03:35 +02:00
Benjamin Peterson 799bd80d8a expose linux extended file system attributes (closes #12720) 2011-08-31 22:15:17 -04:00
Brian Curtin dfc80e3d97 Replace Py_NotImplemented returns with the macro form Py_RETURN_NOTIMPLEMENTED.
The macro was introduced in #12724.
2011-08-10 20:28:54 -05:00
Benjamin Peterson a17a5d67b4 typo 2011-08-09 16:49:13 -05:00
Benjamin Peterson 087a2a951c merge 3.2 2011-08-04 11:09:57 -05:00
Benjamin Peterson fc9bbd1692 dosmodule is, thankfully, no more 2011-08-04 11:07:42 -05:00
Benjamin Peterson 7ac9214e43 fix arg strings 2011-08-03 08:54:26 -05:00
Benjamin Peterson 4e36d5ae88 need NULL sentinel 2011-08-02 19:56:11 -05:00
Benjamin Peterson bad9c2f13a avoid warning when SchedParamType is not used 2011-08-02 18:42:14 -05:00
Benjamin Peterson e3298dda6d only add sched_param if it is initialized 2011-08-02 18:40:46 -05:00
Benjamin Peterson 8f7bdd3208 I have been spoiled by chained comparisons in python 2011-08-02 18:34:30 -05:00
Benjamin Peterson 9b374bfa03 comparing on number of cpus makes more sense 2011-08-02 18:22:30 -05:00
Benjamin Peterson 0163c9aa0c fix sched defines 2011-08-02 18:11:38 -05:00
Benjamin Peterson c5fce4ded2 check individually for some for sched_ functions 2011-08-02 18:07:32 -05:00
Benjamin Peterson e870fe601a make_new_cpu_set takes the number of cpus 2011-08-02 17:44:26 -05:00
Benjamin Peterson 2740af8cc4 sched.h can exist without sched affinity support 2011-08-02 17:41:34 -05:00
Benjamin Peterson 94b580d423 expose sched.h functions (closes #12655) 2011-08-02 17:30:04 -05:00
Charles-François Natali 6613c18ea2 Issue #13415: Test in configure if unsetenv() has a return value or not. 2011-11-27 12:41:06 +01:00
Benjamin Peterson 06403cff16 decref correct object 2011-11-22 23:57:23 -06:00
Giampaolo Rodola' 210e7ca032 Issue #12442: add shutil.disk_usage() 2011-07-01 13:55:36 +02:00
Victor Stinner 6ee7a57b38 (Merge 3.2) posixmodule.c: fix function name in argument parsing
Fix os.fchown() and os.open()

Remove also trailing spaces and replace tabs by spaces.
2011-06-17 15:18:16 +02:00
Victor Stinner 26de69dff8 posixmodule.c: fix function name in argument parsing
Fix os.fchown() and os.open()

Remove also trailing spaces and replace tabs by spaces.
2011-06-17 15:15:38 +02:00
Brian Curtin 4ff1a414f8 Merge 3.2 - update to the fix for #12084 2011-06-14 10:06:41 -05:00
Brian Curtin c8be84077b Correct completely broken os.stat behavior on Windows XP.
After 1a3e8db28d49, Windows XP could not os.stat at all due to raising
immediately when GetFinalPathNameByHandle wasn't available (pre-Vista).
The proper behavior in that situation is to just not attempt a traversal
rather than outright rejecting.

This change additionally handles a failed malloc by setting the error code
and returning false.

Patch by Hirokazu Yamamoto.
2011-06-14 09:52:50 -05:00
Brian Curtin a87d586fd6 branch merge? 2011-06-13 16:10:32 -05:00
Brian Curtin c9d6a501db branch merge 2011-06-13 16:03:01 -05:00
Brian Curtin 3e86c99f90 Merge from 3.2 for Issue #12084. 2011-06-13 16:00:35 -05:00
Brian Curtin d25aef55c8 Fix #12084. os.stat on Windows wasn't working properly with relative symlinks.
Use of DeviceIoControl to obtain the symlink path via the reparse tag was
removed. The code now uses GetFinalPathNameByHandle in the case of a
symbolic link and works properly given the added test which creates a symbolic
link and calls os.stat on it from multiple locations.

Victor Stinner also noticed an issue with os.lstat following the os.stat
code path when being passed bytes. The posix_lstat function was adjusted to
properly hook up win32_lstat instead of the previous STAT macro (win32_stat).
2011-06-13 15:16:04 -05:00
Ross Lagerwall b0ae53d8a0 Issue #9344: Add os.getgrouplist(). 2011-06-10 07:30:30 +02:00
Brian Curtin d9463b233c Merge 3.2 2011-06-09 09:46:21 -05:00
Brian Curtin 95d028fd18 Correction to 88e318166eaf - Issue #11583
Rather than wrapping the C _isdir function in a Python function,
just import the C _isdir function directly. Additionally, add in the
docstring which was left out.
2011-06-09 09:10:38 -05:00
Brian Curtin 9a82eaade3 Fix #11583. Changed os.path.isdir to use GetFileAttributes instead of os.stat.
By changing to the Windows GetFileAttributes API in nt._isdir we can figure
out if the path is a directory without opening the file via os.stat. This has
the minor benefit of speeding up os.path.isdir by at least 2x for regular
files and 10-15x improvements were seen on symbolic links (which opened the
file multiple times during os.stat). Since os.path.isdir is used in
several places on interpreter startup, we get a minor speedup in startup time.
2011-06-08 18:43:57 -05:00