[Python-checkins] CVS: python/dist/src/Lib os.py,1.43,1.44
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 01 Mar 2001 23:04:53 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv17563
Modified Files:
os.py
Log Message:
Fix by Donn Cave for BeOS (SF #403642):
UNIX style fork/execve/wait are not fully compatible with thread
support on BeOS. For Python, that means neither fork() from import
nor import from a fork work reliably. os._execvpe() does the latter,
importing tempfile to set up a tantalizing target for hackers. This
patch replaces both the tempfile name generation and the exec that
uses it, in case we're on BeOS. Need this for
setup:distutils:execvp(); symptoms are random crashes and internal
BeOS error messages about th name, in case we're on BeOS. It's an
issue because setup.py + distutils calls os.execvp(); symptoms are
random crashes during setup.py, and internal BeOS error messages
about thread IDs.
Index: os.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -r1.43 -r1.44
*** os.py 2001/03/02 06:43:49 1.43
--- os.py 2001/03/02 07:04:51 1.44
***************
*** 323,330 ****
PATH = envpath.split(pathsep)
if not _notfound:
! import tempfile
! # Exec a file that is guaranteed not to exist
! try: execv(tempfile.mktemp(), ('blah',))
! except error, _notfound: pass
exc, arg = error, _notfound
for dir in PATH:
--- 323,339 ----
PATH = envpath.split(pathsep)
if not _notfound:
! if sys.platform[:4] == 'beos':
! # Process handling (fork, wait) under BeOS (up to 5.0)
! # doesn't interoperate reliably with the thread interlocking
! # that happens during an import. The actual error we need
! # is the same on BeOS for posix.open() et al., ENOENT.
! try: unlink('/_#.# ## #.#')
! except error, _notfound: pass
! else:
! import tempfile
! t = tempfile.mktemp()
! # Exec a file that is guaranteed not to exist
! try: execv(t, ('blah',))
! except error, _notfound: pass
exc, arg = error, _notfound
for dir in PATH: