Commit Graph

678 Commits

Author SHA1 Message Date
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
Brian Curtin 9c669ccc77 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:17:18 -05:00
Charles-François Natali 368f34bb4b Issue #12196: Make os.pipe2() flags argument mandatory. 2011-06-06 19:49:47 +02:00
Charles-François Natali daafdd5bea Issue #12196: Add pipe2() to the os module. 2011-05-29 20:07:40 +02:00
Victor Stinner 7870bdff5a Issue #6501: os.device_encoding() returns None on Windows if the application
has no console.
2011-05-23 18:12:52 +02:00
Charles-François Natali 1e045b1831 Issue #12105: Add O_CLOEXEC to the os module. 2011-05-22 20:42:32 +02:00
Victor Stinner b90db4caf0 Issue #11918: OS/2 and VMS are no more supported because of the lack of
maintainer.
2011-04-26 22:48:24 +02:00
Antoine Pitrou 877509aef4 Issue #11382: Trivial system calls, such as dup() or pipe(), needn't
release the GIL.  Patch by Charles-François Natali.
2011-04-23 17:21:13 +02:00
Giampaolo Rodola' ff1a73590d os.sendfile(): on Linux if offset parameter is passed as NULL we were erroneously returning a (bytes_sent, None) tuple instead of bytes_sent 2011-04-19 09:47:16 +02:00
Ezio Melotti 4969f709cc #11515: Merge with 3.1. 2011-03-15 05:59:46 +02:00
Ross Lagerwall 9ad63e0914 Fix refleak introduced by #10812. 2011-03-19 09:11:14 +02:00
Ross Lagerwall 4d076da4de Issue #11592: Fix compilation warnings in os module. 2011-03-18 06:56:53 +02:00
Ross Lagerwall 8e74967855 Issue #10812: Revert os.lseek change. 2011-03-17 21:54:07 +02:00
Ross Lagerwall 7807c3545d Issue #10812: Add some extra posix functions to the os module. 2011-03-17 20:20:30 +02:00
Ezio Melotti 373089239b #11515: Merge with 3.2. 2011-03-15 06:03:08 +02:00
Giampaolo Rodolà acdad9a40b Issue 11351 - apply patch by Steffen Daode Nurpmeso which should fix TestSendfile.test_headers failure on OSX. 2011-03-03 16:10:51 +00:00
Benjamin Peterson d8a43b4a4b revert accidental formatting change 2011-02-26 21:35:16 +00:00
Benjamin Peterson c6696d272f this isn't true anymore 2011-02-26 21:32:16 +00:00
Antoine Pitrou dcc20b8563 Check error return from _parse_off_t(), and remove cruft from the 2->3 transition. 2011-02-26 13:38:35 +00:00
Antoine Pitrou 8250e23abd Issue #10755: Add the posix.fdlistdir() function. Patch by Ross Lagerwall. 2011-02-25 23:41:16 +00:00
Antoine Pitrou f65132de3d Issue #4761: Add the *at() family of functions (openat(), etc.) to the posix
module.  Patch by Ross Lagerwall.
2011-02-25 23:25:17 +00:00
Giampaolo Rodolà 18e8bcb289 Issue 10784: adds os.getpriority() and os.setpriority() functions. 2011-02-25 20:57:54 +00:00
Georg Brandl a391b11320 Rename internal helper function and make it static. 2011-02-25 15:23:18 +00:00
Giampaolo Rodolà c9c2c8b034 Issue 10882: add os.sendfile(). (patch provided by Ross Lagerwall) 2011-02-25 14:39:16 +00:00
Antoine Pitrou 710e96651d Merged revisions 88111 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88111 | antoine.pitrou | 2011-01-19 16:21:35 +0100 (mer., 19 janv. 2011) | 4 lines

  Issue #10898: Allow compiling the posix module when the C library defines
  a symbol named FSTAT.
........
2011-01-19 15:26:37 +00:00
Antoine Pitrou e47e093f70 Issue #10898: Allow compiling the posix module when the C library defines
a symbol named FSTAT.
2011-01-19 15:21:35 +00:00
Victor Stinner 7234479580 Issue #9611: remove useless and dangerous explicit conversion to size_t 2011-01-11 00:04:12 +00:00
Antoine Pitrou ff17385fbd Merged revisions 87802 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87802 | antoine.pitrou | 2011-01-06 19:25:55 +0100 (jeu., 06 janv. 2011) | 6 lines

  Issue #7858: Raise an error properly when os.utime() fails under Windows
  on an existing file.

  (this does not seem to be easily testable)
........
2011-01-06 18:29:05 +00:00
Antoine Pitrou e85da7aa4f Issue #7858: Raise an error properly when os.utime() fails under Windows
on an existing file.

(this does not seem to be easily testable)
2011-01-06 18:25:55 +00:00
Victor Stinner e6edec2371 Issue #9015, #9611: FileIO.readinto(), FileIO.write() and os.write() clamp the
length to 2^31-1 on Windows.
2011-01-04 00:29:35 +00:00
Amaury Forgeot d'Arc 32e8aab1fb Merged revisions 87666 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87666 | amaury.forgeotdarc | 2011-01-03 01:19:11 +0100 (lun., 03 janv. 2011) | 4 lines

  #8278: In the Windows implementation of stat() and utime(),
  use time_t instead of int.  This gives support for dates after 2038,
  at least when compiled with VS2003 or later, where time_t is 64bit.
........
2011-01-03 00:40:04 +00:00
Amaury Forgeot d'Arc a251a853c7 #8278: In the Windows implementation of stat() and utime(),
use time_t instead of int.  This gives support for dates after 2038,
at least when compiled with VS2003 or later, where time_t is 64bit.
2011-01-03 00:19:11 +00:00
Brian Curtin 3b4499c5c7 Fix #9333. The symlink function is always available now, raising OSError
when the user doesn't hold the symbolic link privilege rather than hiding it.
2010-12-28 14:31:47 +00:00
Hirokazu Yamamoto 7ed117addf Issue #10637: Called CloseHandle twice in os.stat/os.lstat (Windows) 2010-12-07 10:24:37 +00:00
Hirokazu Yamamoto 26253bb09e Should use posix_error here. 2010-12-05 04:16:47 +00:00
Hirokazu Yamamoto 74673513e7 Sorry, I had introduced tab in source code. 2010-12-05 02:48:08 +00:00
Hirokazu Yamamoto 427d3149eb Fixed several corner case issues on os.stat/os.lstat related to reparse
points. (Windows)

- Set S_IEXEC via final path name not link name.
- Set S_IFLNK also via FindFirstFile (when CreateFile fails)
2010-12-04 10:16:05 +00:00
Brian Curtin 52173d4959 Fix #9333. Expose os.symlink on Windows only when usable.
In order to create symlinks on Windows, SeCreateSymbolicLinkPrivilege
is an account privilege that is required to be held by the user. Not only
must the privilege be enabled for the account, the activated privileges for
the currently running application must be adjusted to enable the requested
privilege.

Rather than exposing an additional function to be called prior to the user's
first os.symlink call, we handle the AdjustTokenPrivileges Windows API call
internally and only expose os.symlink when the privilege escalation was
successful.

Due to the change of only exposing os.symlink when it's available, we can
go back to the original test skipping methods of checking via `hasattr`.
2010-12-02 18:29:18 +00:00
Georg Brandl 71c23d4473 Include structseq.h in Python.h, and remove now-redundant includes in individual sources. 2010-11-30 09:30:54 +00:00
Brian Curtin fc889c48ed Fix for #8879.
Amaury noticed that this was originally written in a way that would fail on
names that can't be encoded with the mbcs codec. Restructured the function
to work with wide names first then narrow names second, to fall in line
with the way other functions are written in posixmodule.c.
2010-11-28 23:59:46 +00:00