mirror of https://github.com/python/cpython
Another batch...
This commit is contained in:
parent
c458e945a4
commit
28d4ba24c9
|
@ -196,6 +196,9 @@ class _posixfile_:
|
||||||
elif sys.platform in ['aix3', 'aix4']:
|
elif sys.platform in ['aix3', 'aix4']:
|
||||||
l_type, l_whence, l_start, l_len, l_sysid, l_pid, l_vfs = \
|
l_type, l_whence, l_start, l_len, l_sysid, l_pid, l_vfs = \
|
||||||
struct.unpack('hhlllii', flock)
|
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:
|
else:
|
||||||
l_type, l_whence, l_start, l_len, l_sysid, l_pid = \
|
l_type, l_whence, l_start, l_len, l_sysid, l_pid = \
|
||||||
struct.unpack('hhllhh', flock)
|
struct.unpack('hhllhh', flock)
|
||||||
|
|
|
@ -10,7 +10,6 @@ __version__ = "0.3"
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pwd
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import socket
|
import socket
|
||||||
|
@ -20,17 +19,6 @@ import SocketServer
|
||||||
import BaseHTTPServer
|
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):
|
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
|
|
||||||
"""Simple HTTP request handler with GET and HEAD commands.
|
"""Simple HTTP request handler with GET and HEAD commands.
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
|
|
||||||
from test_support import *
|
from test_support import *
|
||||||
|
|
||||||
eps=1e-5
|
seps='1e-05'
|
||||||
print 'math module, testing with eps', eps
|
eps = eval(seps)
|
||||||
|
print 'math module, testing with eps', seps
|
||||||
import math
|
import math
|
||||||
|
|
||||||
def testit(name, value, expected):
|
def testit(name, value, expected):
|
||||||
|
|
|
@ -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)
|
|
@ -196,6 +196,9 @@ class _posixfile_:
|
||||||
elif sys.platform in ['aix3', 'aix4']:
|
elif sys.platform in ['aix3', 'aix4']:
|
||||||
l_type, l_whence, l_start, l_len, l_sysid, l_pid, l_vfs = \
|
l_type, l_whence, l_start, l_len, l_sysid, l_pid, l_vfs = \
|
||||||
struct.unpack('hhlllii', flock)
|
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:
|
else:
|
||||||
l_type, l_whence, l_start, l_len, l_sysid, l_pid = \
|
l_type, l_whence, l_start, l_len, l_sysid, l_pid = \
|
||||||
struct.unpack('hhllhh', flock)
|
struct.unpack('hhllhh', flock)
|
||||||
|
|
|
@ -10,7 +10,6 @@ __version__ = "0.3"
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pwd
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import socket
|
import socket
|
||||||
|
@ -20,17 +19,6 @@ import SocketServer
|
||||||
import BaseHTTPServer
|
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):
|
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
|
|
||||||
"""Simple HTTP request handler with GET and HEAD commands.
|
"""Simple HTTP request handler with GET and HEAD commands.
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
|
|
||||||
from test_support import *
|
from test_support import *
|
||||||
|
|
||||||
eps=1e-5
|
seps='1e-05'
|
||||||
print 'math module, testing with eps', eps
|
eps = eval(seps)
|
||||||
|
print 'math module, testing with eps', seps
|
||||||
import math
|
import math
|
||||||
|
|
||||||
def testit(name, value, expected):
|
def testit(name, value, expected):
|
||||||
|
|
|
@ -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)
|
Loading…
Reference in New Issue