]> granicus.if.org Git - python/commitdiff
Another batch...
authorGuido van Rossum <guido@python.org>
Wed, 11 Sep 1996 19:07:45 +0000 (19:07 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 11 Sep 1996 19:07:45 +0000 (19:07 +0000)
Lib/dos-8x3/posixfil.py
Lib/dos-8x3/simpleht.py
Lib/dos-8x3/test_mat.py
Lib/dos-8x3/test_str.py [new file with mode: 0644]
Lib/dos_8x3/posixfil.py
Lib/dos_8x3/simpleht.py
Lib/dos_8x3/test_mat.py
Lib/dos_8x3/test_str.py [new file with mode: 0644]

index f0df5433aa0c1c2be180fc35755df60b631c46e8..fc5f53fe2cad030e1a2674a9d9e8d3a4c10da38f 100755 (executable)
@@ -196,6 +196,9 @@ class _posixfile_:
             elif sys.platform in ['aix3', 'aix4']:
                 l_type, l_whence, l_start, l_len, l_sysid, l_pid, l_vfs = \
                     struct.unpack('hhlllii', flock)
+           elif sys.platform == "linux2":
+               l_type, l_whence, l_start, l_len, l_pid, l_sysid = \
+                   struct.unpack('hhllhh', flock)
            else:
                l_type, l_whence, l_start, l_len, l_sysid, l_pid = \
                    struct.unpack('hhllhh', flock)
index dd3107abc6faf1bad7172896c0e17d00e84c9d7a..ac3e38411593bac8cda93329448150e3fef1df0c 100755 (executable)
@@ -10,7 +10,6 @@ __version__ = "0.3"
 
 
 import os
-import pwd
 import sys
 import time
 import socket
@@ -20,17 +19,6 @@ import SocketServer
 import BaseHTTPServer
 
 
-def nobody_uid():
-    """Internal routine to get nobody's uid"""
-    try:
-       nobody = pwd.getpwnam('nobody')[2]
-    except pwd.error:
-       nobody = 1 + max(map(lambda x: x[2], pwd.getpwall()))
-    return nobody
-
-nobody = nobody_uid()
-
-
 class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
 
     """Simple HTTP request handler with GET and HEAD commands.
index af84d2a614d55d9416da66bf08894ee3ba95ae48..6d6bc44953833e8bc2d5745db8b3d757611a0014 100644 (file)
@@ -3,8 +3,9 @@
 
 from test_support import *
 
-eps=1e-5
-print 'math module, testing with eps', eps
+seps='1e-05'
+eps = eval(seps)
+print 'math module, testing with eps', seps
 import math
 
 def testit(name, value, expected):
diff --git a/Lib/dos-8x3/test_str.py b/Lib/dos-8x3/test_str.py
new file mode 100644 (file)
index 0000000..5b2ddfb
--- /dev/null
@@ -0,0 +1,21 @@
+import strop, sys
+
+def test(name, input, output):
+    f = getattr(strop, name)
+    try:
+       value = f(input)
+    except:
+        value = sys.exc_type
+        print sys.exc_value
+    if value != output:
+       print f, `input`, `output`, `value`
+
+test('atoi', " 1 ", 1)
+test('atoi', " 1x", ValueError)
+test('atoi', " x1 ", ValueError)
+test('atol', "  1  ", 1L)
+test('atol', "  1x ", ValueError)
+test('atol', "  x1 ", ValueError)
+test('atof', "  1  ", 1.0)
+test('atof', "  1x ", ValueError)
+test('atof', "  x1 ", ValueError)
index f0df5433aa0c1c2be180fc35755df60b631c46e8..fc5f53fe2cad030e1a2674a9d9e8d3a4c10da38f 100755 (executable)
@@ -196,6 +196,9 @@ class _posixfile_:
             elif sys.platform in ['aix3', 'aix4']:
                 l_type, l_whence, l_start, l_len, l_sysid, l_pid, l_vfs = \
                     struct.unpack('hhlllii', flock)
+           elif sys.platform == "linux2":
+               l_type, l_whence, l_start, l_len, l_pid, l_sysid = \
+                   struct.unpack('hhllhh', flock)
            else:
                l_type, l_whence, l_start, l_len, l_sysid, l_pid = \
                    struct.unpack('hhllhh', flock)
index dd3107abc6faf1bad7172896c0e17d00e84c9d7a..ac3e38411593bac8cda93329448150e3fef1df0c 100755 (executable)
@@ -10,7 +10,6 @@ __version__ = "0.3"
 
 
 import os
-import pwd
 import sys
 import time
 import socket
@@ -20,17 +19,6 @@ import SocketServer
 import BaseHTTPServer
 
 
-def nobody_uid():
-    """Internal routine to get nobody's uid"""
-    try:
-       nobody = pwd.getpwnam('nobody')[2]
-    except pwd.error:
-       nobody = 1 + max(map(lambda x: x[2], pwd.getpwall()))
-    return nobody
-
-nobody = nobody_uid()
-
-
 class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
 
     """Simple HTTP request handler with GET and HEAD commands.
index af84d2a614d55d9416da66bf08894ee3ba95ae48..6d6bc44953833e8bc2d5745db8b3d757611a0014 100644 (file)
@@ -3,8 +3,9 @@
 
 from test_support import *
 
-eps=1e-5
-print 'math module, testing with eps', eps
+seps='1e-05'
+eps = eval(seps)
+print 'math module, testing with eps', seps
 import math
 
 def testit(name, value, expected):
diff --git a/Lib/dos_8x3/test_str.py b/Lib/dos_8x3/test_str.py
new file mode 100644 (file)
index 0000000..5b2ddfb
--- /dev/null
@@ -0,0 +1,21 @@
+import strop, sys
+
+def test(name, input, output):
+    f = getattr(strop, name)
+    try:
+       value = f(input)
+    except:
+        value = sys.exc_type
+        print sys.exc_value
+    if value != output:
+       print f, `input`, `output`, `value`
+
+test('atoi', " 1 ", 1)
+test('atoi', " 1x", ValueError)
+test('atoi', " x1 ", ValueError)
+test('atol', "  1  ", 1L)
+test('atol', "  1x ", ValueError)
+test('atol', "  x1 ", ValueError)
+test('atof', "  1  ", 1.0)
+test('atof', "  1x ", ValueError)
+test('atof', "  x1 ", ValueError)