355 Commits

Author SHA1 Message Date
Martin v. Löwis
b8f82e6feb Backport r45505, r45573, r45576
- reset errno before calling confstr - use confstr() doc to simplify
  checks afterwards
- Correct implementation and documentation of os.confstr.  Add a simple
  test case.  I've yet to figure out how to provoke a None return I can test.
- Address issues brought up by MvL on python-checkins.
  I tested this with valgrind on amd64.

  The man pages I found for diff architectures are inconsistent on this.
  I'm not entirely sure this change is correct for all architectures
  either.

  Perhaps we should just over-allocate and not worry about it?

The change to return None instead of "" in case of unconfigured
values has not been backported.
2006-10-09 19:29:06 +00:00
Ronald Oussoren
392cafba4f Port of universal binary support for Mac OSX from python 2.5. This takes away
the need for the out-of-tree universal binary support that was used to build
the 2.4.3 installer.

Missing here relative to that tree are some changes to IDLE, IMHO those patches
aren't appropriate for the 2.4 branch and users are better of using 2.5's IDLE.
2006-10-08 17:41:25 +00:00
Andrew M. Kuchling
a1ade3e925 [Backport r51223 | neal.norwitz]
If _stat_float_times is false, we will try to INCREF ival which could be NULL.
Return early in that case.  The caller checks for PyErr_Occurred so this
should be ok.

Klocwork #297
2006-10-05 17:24:08 +00:00
Andrew M. Kuchling
602117a696 [Backport rev. 39135 by mwh]
Fix bug

[ 1232517 ] OverflowError in time.utime() causes strange traceback

A needed error check was missing.

(Actually, this error check may only have become necessary in fairly
recent Python, not sure).

Backport candidate.

[A few lines below the code in 2.4 touched by the patch, there's already
 a similar check of (intval == -1 && PyErr_Occurred()), so I think
 this function can already report such errors, and therefore the fix
 still applies.  Perhaps Michael can clarify what he was referring to. --amk]
2006-09-28 17:16:25 +00:00
Andrew M. Kuchling
e7031223e3 [Backport of rev. 42093 by neal.norwitz]
Check return result from Py_InitModule*().  This API can fail.

Probably should be backported.
2006-09-27 19:17:32 +00:00
Georg Brandl
5e6d03114e Bug #1551427: fix a wrong NULL pointer check in the win32 version
of os.urandom().
 (backport from rev. 51762)
2006-09-06 06:04:03 +00:00
Martin v. Löwis
e3f1ab7255 Bug #1524310: Properly report errors from FindNextFile in os.listdir. 2006-07-24 12:57:47 +00:00
Martin v. Löwis
cd9a3bbc0f Backport of 46010
- Test for sys/statvfs.h before including it, as statvfs is present
  on some OSX installations, but its header file is not.
2006-05-16 07:06:33 +00:00
Thomas Wouters
eba52802cd Backport trunk's r45715:
Define MAXPATHLEN to be at least PATH_MAX, if that's defined. Python uses
MAXPATHLEN-sized buffers for various output-buffers (like to realpath()),
and that's correct on BSD platforms, but not Linux (which uses PATH_MAX, and
does not define MAXPATHLEN.) Cursory googling suggests Linux is following a
newer standard than BSD, but in cases like this, who knows. Using the
greater of PATH_MAX and 1024 as a fallback for MAXPATHLEN seems to be the
most portable solution.
2006-04-25 15:33:48 +00:00
Georg Brandl
e539fad2e7 Clear errno before calling opendir() and readdir().
(backport from rev. 45262)
2006-04-11 07:04:09 +00:00
Georg Brandl
653d87d1d7 Bug #1467952: backport: make os.listdir() raise if readdir() fails 2006-04-11 06:51:25 +00:00
Thomas Wouters
fe1c16f4be Backport trunk's r43510: In the fdopen(fd, 'a') case on UNIX, don't try to
set fd's flags to -1 if fcntl() and fdopen() both fail.
2006-03-31 22:39:56 +00:00
Georg Brandl
5c1498057a Add guards against fcntl() not being available on Windows.
(backport from rev. 43504)
2006-03-31 20:27:27 +00:00
Georg Brandl
38bb9c6d14 bug #1461855: make os.fdopen() add the O_APPEND flag if using "a" mode.
glibc, for example, does this already on its own, but it seems that
the solaris libc doesn't. This leads to Python code being able to over-
write file contents even though having specified "a" mode.
 (backport from rev. 43501)
2006-03-31 20:00:15 +00:00
Georg Brandl
d98dbf9e70 Bug #869197: setgroups rejects long integer argument 2005-11-22 19:31:08 +00:00
Georg Brandl
e32757cf4f Commit memory leaking fix. 2005-09-25 06:16:28 +00:00
Neal Norwitz
c36179bf81 Fix problems reported by valgrind:
* Fix memory leak in posix.access()
 * Fix use of uninitialized value in forkpty()
   - from the manpage it isn't clear if there are conditions where master_fd
     are uninitialized, but it's safer to initialize
2005-09-19 06:42:30 +00:00
Georg Brandl
a38d85fbc2 bug [ 1007046 ] os.startfile() doesn't accept Unicode filenames 2005-09-14 20:51:40 +00:00
Martin v. Löwis
d84b9d30c3 Backport of change to os.access to encode Unicode file names with
the file system encoding.
2005-03-13 22:18:26 +00:00
Andrew MacIntyre
995d9bf127 fix unterminated comment 2004-12-18 09:48:40 +00:00
Andrew MacIntyre
74b443ce1d OS/2 specific fixes related to SF bug # 1003471.
Also revise a related function to minimise file handle/pipe leakage
and improve reliability.

Backported from -HEAD.
2004-12-12 08:34:33 +00:00
Anthony Baxter
8a560dee72 Patch 977343, Solaris likes sys/loadavg.h. Added support for sys/loadavg.h
detection to configure &c.
2004-10-13 15:30:56 +00:00
Anthony Baxter
9ceaa72ebe Patch #975056 - fixes for restartable signals on *BSD. In addition,
a few remaining calls to signal() were converted to PyOS_setsig().
2004-10-13 14:48:50 +00:00
Armin Rigo
b6aa856f25 Patch #1009075, bug #952953: allow execve with empty 2nd argument 2004-09-27 19:54:33 +00:00
Tim Peters
d311538a93 win32_urandom(): There's no need to copy the generated byte string, so
don't.
2004-08-30 17:36:46 +00:00