summaryrefslogtreecommitdiff
blob: 7dd90f72f209635c751f31450afab5973346c44a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v
retrieving revision 1.50.8.2
retrieving revision 1.50.8.4
diff -u -r1.50.8.2 -r1.50.8.4
--- python/python/dist/src/Lib/os.py	2002/03/16 18:02:20	1.50.8.2
+++ python/python/dist/src/Lib/os.py	2002/09/03 16:36:59	1.50.8.4
@@ -298,7 +298,7 @@
     _execvpe(file, args)
 
 def execvpe(file, args, env):
-    """execv(file, args, env)
+    """execvpe(file, args, env)
 
     Execute the executable file (which is searched for along $PATH)
     with argument list args and environment env , replacing the
@@ -308,8 +308,9 @@
 
 __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"])
 
-_notfound = None
 def _execvpe(file, args, env=None):
+    from errno import ENOENT, ENOTDIR
+
     if env is not None:
         func = execve
         argrest = (args, env)
@@ -317,7 +318,7 @@
         func = execv
         argrest = (args,)
         env = environ
-    global _notfound
+
     head, tail = path.split(file)
     if head:
         apply(func, (file,) + argrest)
@@ -327,30 +328,21 @@
     else:
         envpath = defpath
     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
+    saved_exc = None
+    saved_tb = None
     for dir in PATH:
         fullname = path.join(dir, file)
         try:
             apply(func, (fullname,) + argrest)
-        except error, (errno, msg):
-            if errno != arg[0]:
-                exc, arg = error, (errno, msg)
-    raise exc, arg
-
+        except error, e:
+            tb = sys.exc_info()[2]
+            if (e.errno != ENOENT and e.errno != ENOTDIR
+                and saved_exc is None):
+                saved_exc = e
+                saved_tb = tb
+    if saved_exc:
+        raise error, saved_exc, saved_tb
+    raise error, e, tb
 
 # Change environ to automatically call putenv() if it exists
 try:

===================================================================
RCS file: /cvsroot/python/python/dist/src/setup.py,v
retrieving revision 1.73.4.4
retrieving revision 1.73.4.7
diff -u -r1.73.4.4 -r1.73.4.7
--- python/python/dist/src/setup.py	2002/03/26 13:43:04	1.73.4.4
+++ python/python/dist/src/setup.py	2002/08/08 19:52:42	1.73.4.7
@@ -273,8 +273,6 @@
         exts.append( Extension('pwd', ['pwdmodule.c']) )
         # grp(3)
         exts.append( Extension('grp', ['grpmodule.c']) )
-        # posix (UNIX) errno values
-        exts.append( Extension('errno', ['errnomodule.c']) )
         # select(2); not on ancient System V
         exts.append( Extension('select', ['selectmodule.c']) )

===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v
retrieving revision 1.24
retrieving revision 1.24.10.2
diff -u -r1.24 -r1.24.10.2
--- python/python/dist/src/Modules/Setup.dist	2001/10/17 13:46:28	1.24
+++ python/python/dist/src/Modules/Setup.dist	2002/08/08 19:52:42	1.24.10.2
@@ -97,6 +97,7 @@
 # setup.py script in the root of the Python source tree.
 
 posix posixmodule.c		# posix (UNIX) system calls
+errno errnomodule.c		# posix (UNIX) errno values
 _sre _sre.c			# Fredrik Lundh's new regular expressions
 new newmodule.c			# Tommy Burnette's 'new' module
 
@@ -166,7 +167,6 @@
 #fcntl fcntlmodule.c	# fcntl(2) and ioctl(2)
 #pwd pwdmodule.c		# pwd(3) 
 #grp grpmodule.c		# grp(3)
-#errno errnomodule.c	# posix (UNIX) errno values
 #select selectmodule.c	# select(2); not on ancient System V