Commit Graph

464 Commits

Author SHA1 Message Date
Gregory P. Smith 4b862365c8 Fix for r78527. It left out updating forkpty. 2010-03-01 02:31:33 +00:00
Gregory P. Smith 9e5d1327f8 Issue #7242: On Solaris 9 and earlier calling os.fork() from within a
thread could raise an incorrect RuntimeError about not holding the import
lock.  The import lock is now reinitialized after fork.
2010-03-01 01:22:39 +00:00
Ronald Oussoren a55af9a9db - Issue #7658: Ensure that the new pythonw executable works on OSX 10.4
- Issue #7714: Use ``gcc -dumpversion`` to detect the version of GCC on
  MacOSX.

- Make configure look for util.h as well as libutil.h. The former
  is the header file that on OSX contains the defition of openpty.

  (Needed to compile for OSX 10.4 on OSX 10.6)

- Use the correct definition of CC to compile the pythonw executable
2010-01-17 16:25:57 +00:00
Gregory P. Smith 9f12d468f4 Fix possible integer overflow in lchown and fchown functions. For issue1747858. 2009-12-23 09:31:11 +00:00
Antoine Pitrou 30b3b35cba Issue #7333: The `posix` module gains an `initgroups()` function providing
access to the initgroups(3) C library call on Unix systems which implement
it.  Patch by Jean-Paul Calderone.
2009-12-02 20:37:54 +00:00
Martin v. Löwis 50ea4565bd Issue #6508: Add posix.{getresuid,getresgid,setresuid,setresgid}. 2009-11-27 13:56:01 +00:00
Thomas Wouters c4dcb3801e Fix issue #1590864, multiple threads and fork() can cause deadlocks, by
acquiring the import lock around fork() calls. This prevents other threads
from having that lock while the fork happens, and is the recommended way of
dealing with such issues. There are two other locks we care about, the GIL
and the Thread Local Storage lock. The GIL is obviously held when calling
Python functions like os.fork(), and the TLS lock is explicitly reallocated
instead, while also deleting now-orphaned TLS data.

This only fixes calls to os.fork(), not extension modules or embedding
programs calling C's fork() directly. Solving that requires a new set of API
functions, and possibly a rewrite of the Python/thread_*.c mess. Add a
warning explaining the problem to the documentation in the mean time.

This also changes behaviour a little on AIX. Before, AIX (but only AIX) was
getting the import lock reallocated, seemingly to avoid this very same
problem. This is not the right approach, because the import lock is a
re-entrant one, and reallocating would do the wrong thing when forking while
holding the import lock.

Will backport to 2.6, minus the tiny AIX behaviour change.
2009-09-16 19:55:54 +00:00
Hirokazu Yamamoto bcff47a6ec Issue #4856: Py_GetFileAttributesEx[AW] are not needed because GetFileAttributesEx[AW]
won't fail with ERROR_CALL_NOT_IMPLEMENTED on win NT.
Reviewed by Amaury Forgeot d'Arc.
2009-06-29 11:27:03 +00:00
Hirokazu Yamamoto a3c5609079 Issue #4856: Remove checks for win NT. 2009-06-28 10:23:00 +00:00
Antoine Pitrou 4fe3858991 Fix build under Windows 2009-05-24 12:15:04 +00:00
Antoine Pitrou 76dd2d1459 Some pid_t-expecting or producing functions were forgotten in r72852. 2009-05-23 16:06:49 +00:00
Antoine Pitrou 5e858fe52b Issue #1983: Fix functions taking or returning a process identifier to use
the dedicated C type `pid_t` instead of a C `int`. Some platforms have
a process identifier type wider than the standard C integer type.
2009-05-23 15:37:45 +00:00
Hirokazu Yamamoto b24bb27d22 Issue #3527: Removed Py_WIN_WIDE_FILENAMES which is not used any more. 2009-05-17 02:52:09 +00:00
Hirokazu Yamamoto 406d7aaee7 Issue #5913: os.listdir() should fail for empty path on windows. 2009-05-04 05:28:39 +00:00
Gregory P. Smith 6d30793cf2 Fixes issue5705: os.setuid() and friends did not accept the same range of
values that pwd.getpwnam() returns.
2009-04-05 23:43:58 +00:00
Kristján Valur Jónsson feab33418d http://bugs.python.org/issue5623
Dynamically discoverd the size of the ioinfo struct used by the crt for its file descriptors.  This should work across all flavors of the CRT.  Thanks to Amaury Forgeot d'Arc
Needs porting to 3.1
2009-04-01 16:08:34 +00:00
Mark Dickinson 3e4caeb3bf Issue #5341: Fix a variety of spelling errors. 2009-02-21 20:27:01 +00:00
Kristján Valur Jónsson 6a743d3694 Issue 4804. Add a function to test the validity of file descriptors on Windows, and stop using global runtime settings to silence the warnings / assertions. 2009-02-10 13:32:24 +00:00
Benjamin Peterson 943a6ddc72 simplify code 2009-01-19 15:51:27 +00:00
Kristján Valur Jónsson 2e659ce36f Issue 4957
Let os.ftruncate raise OSError like documented.
2009-01-19 13:10:27 +00:00
Martin v. Löwis 03824e45f6 Issue #1040026: Fix os.times result on systems where HZ is incorrect. 2008-12-29 18:17:34 +00:00
Hirokazu Yamamoto ed29bb49f8 Issue #4071: ntpath.abspath returned an empty string for long unicode path. 2008-11-08 03:46:17 +00:00
Hirokazu Yamamoto 61376409a9 removed unused _PyUnicode_FromFileSystemEncodedObject.
made win32_chdir, win32_wchdir static.
2008-10-16 06:25:25 +00:00
Hirokazu Yamamoto 6c75a30712 r66862 contained memory leak. 2008-10-09 10:11:21 +00:00
Hirokazu Yamamoto 10a018c285 On windows, os.chdir given unicode was not working if GetCurrentDirectoryW
returned a path longer than MAX_PATH. (But It's doubtful this code path is
really executed because I cannot move to such directory on win2k)
2008-10-09 10:00:30 +00:00
Hirokazu Yamamoto a0fdd72f8e Issue #2222: Fixed reference leak when occured os.rename()
fails unicode conversion on 2nd parameter. (windows only)
2008-08-17 09:19:52 +00:00
Martin v. Löwis f91d46a17d Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
by denying s# to parse objects that have a releasebuffer procedure,
and introducing s*.

More module might need to get converted to use s*.
2008-08-12 14:49:50 +00:00
Amaury Forgeot d'Arc 74bd40d85c On Windows, silence a Purify warning and initialize the memory passed to CryptGenRandom.
Since python doesn't provide any particular random data, it seems more reasonable anyway.
2008-07-21 21:06:46 +00:00
Georg Brandl 86cbf81b47 #1608818: errno can get set by every call to readdir(). 2008-07-16 21:31:41 +00:00
Gregory P. Smith fb7a50fbb9 Fix posix.fork1() / os.fork1() to only call PyOS_AfterFork() in the child
process rather than both parent and child.

Does anyone actually use fork1()?  It appears to be a Solaris thing
but if Python is built with pthreads on Solaris, fork1() and fork()
should be the same.
2008-07-14 06:06:48 +00:00
Facundo Batista 5596b0cfc2 Issue #2722. Now the char buffer to support the path string has
not fixed length, it mallocs memory if needed. As a result, we
don't have a maximum for the getcwd() method.
2008-06-22 13:36:20 +00:00
Gregory P. Smith dd96db63f6 This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Georg Brandl 5049a858ba #2890: support os.O_ASYNC and fcntl.FASYNC. 2008-05-16 13:10:15 +00:00
Gregory P. Smith f48da8fbcd Fix chown on 64-bit linux. It needed to take a long (64-bit on 64bit linux) as
uid and gid input to accept values >=2**31 as valid while still accepting
negative numbers to pass -1 to chown for "no change".

Fixes issue1747858.

This should be backported to release25-maint.
2008-03-18 19:05:32 +00:00
Brett Cannon 10ed0f50a9 Remove all traces of HAVE_STRERROR.
The removal of strerror.c led to the function check being removed from
configure.in.
2008-03-18 15:35:58 +00:00
Georg Brandl 0a40ffb1b3 #2063: correct order of utime and stime in os.times()
result on Windows.
2008-02-13 07:20:22 +00:00
Christian Heimes e6a8074892 Another int -> pid_t case 2008-02-03 19:51:13 +00:00
Andrew MacIntyre 94dcf0ddbf The wrapper function is supposed to be for spawnvpe() so that's
what we should call [this wrapper only available on OS/2].

Backport candidate to 2.5.
2008-02-03 07:07:31 +00:00
Christian Heimes d491d71903 More int -> pid_t. 2008-02-01 18:49:26 +00:00
Christian Heimes 951cc0f474 Fixed bug #1983: Return from fork() is pid_t, not int 2008-01-31 23:08:23 +00:00
Georg Brandl 309501a617 #1663329: add os.closerange() to close a range of fds,
ignoring errors, and use this in subprocess to speed up
subprocess creation in close_fds mode. Patch by Mike Klaas.
2008-01-19 20:22:13 +00:00
Christian Heimes 000a074c95 Modified PyImport_Import and PyImport_ImportModule to always use absolute imports by calling __import__ with an explicit level of 0
Added a new API function PyImport_ImportModuleNoBlock. It solves the problem with dead locks when mixing threads and imports
2008-01-03 22:16:32 +00:00
Christian Heimes e93237dfcc #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available. 2007-12-19 02:37:44 +00:00
Martin v. Löwis 7b3cc06a9a Forward-port r59310:
os.access now returns True on Windows for any existing directory.
2007-12-03 23:09:04 +00:00
Christian Heimes 3628187b66 Fix for feature request #1528 Add os.fchmod
Georg Brandl has added fchmod() and fchown(). I've contributed lchown but I'm not able to test it on Linux. However it should be available on Mac and some other flavors of Unix.
I've made a quick test of fchmod() and fchown() on my system. They are working as expected.
2007-11-30 21:11:28 +00:00
Georg Brandl b67da6ed2b #1735632: add O_NOATIME constant to os module.
Also document a few other O_ constants that were missing from documentation.
2007-11-24 13:56:09 +00:00
Martin v. Löwis af699dd621 Document that we rely on the OS to release the crypto
context. Fixes #1626801.
2007-09-04 09:51:57 +00:00
Neal Norwitz 91a57216c9 Fix memory leak in os.readlink 2007-08-12 17:11:13 +00:00
Martin v. Löwis 6819210b9e PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00