Whitespace normalization.
This commit is contained in:
parent
5303a96808
commit
58eb11cf62
|
@ -171,7 +171,8 @@ class build_ext (Command):
|
||||||
# Append the source distribution include and library directories,
|
# Append the source distribution include and library directories,
|
||||||
# this allows distutils on windows to work in the source tree
|
# this allows distutils on windows to work in the source tree
|
||||||
self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC'))
|
self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC'))
|
||||||
self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild'))
|
self.library_dirs.append(os.path.join(sys.exec_prefix, 'PC', 'VC6'))
|
||||||
|
#self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild'))
|
||||||
|
|
||||||
# OS/2 (EMX) doesn't support Debug vs Release builds, but has the
|
# OS/2 (EMX) doesn't support Debug vs Release builds, but has the
|
||||||
# import libraries in its "Config" subdirectory
|
# import libraries in its "Config" subdirectory
|
||||||
|
|
|
@ -264,4 +264,3 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
loops = LOOPS
|
loops = LOOPS
|
||||||
main(loops)
|
main(loops)
|
||||||
|
|
||||||
|
|
|
@ -58,4 +58,3 @@ def test_main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -131,4 +131,3 @@ def test_main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -54,4 +54,3 @@ def test_main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -28,4 +28,3 @@ def test_main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -31,4 +31,3 @@ def test_main():
|
||||||
test_multibytecodec_support.register_skip_expected(TestGB2312Map, TestGBKMap)
|
test_multibytecodec_support.register_skip_expected(TestGB2312Map, TestGBKMap)
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -87,4 +87,3 @@ test_multibytecodec_support.register_skip_expected(TestCP932Map,
|
||||||
TestSJISX0213Map)
|
TestSJISX0213Map)
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -48,4 +48,3 @@ test_multibytecodec_support.register_skip_expected(TestCP949Map,
|
||||||
TestEUCKRMap, TestJOHABMap)
|
TestEUCKRMap, TestJOHABMap)
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -36,4 +36,3 @@ def test_main():
|
||||||
test_multibytecodec_support.register_skip_expected(TestBIG5Map, TestCP950Map)
|
test_multibytecodec_support.register_skip_expected(TestBIG5Map, TestCP950Map)
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -15,4 +15,3 @@ class TestSFbugs(unittest.TestCase):
|
||||||
Doctests = doctest.DocTestSuite(difflib)
|
Doctests = doctest.DocTestSuite(difflib)
|
||||||
|
|
||||||
test_support.run_unittest(TestSFbugs, Doctests)
|
test_support.run_unittest(TestSFbugs, Doctests)
|
||||||
|
|
||||||
|
|
|
@ -76,4 +76,3 @@ def test_main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -230,4 +230,3 @@ def register_skip_expected(*cases):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
sys.modules[case.__module__].skip_expected = False
|
sys.modules[case.__module__].skip_expected = False
|
||||||
|
|
||||||
|
|
|
@ -270,5 +270,3 @@ def test_main(verbose=None):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main(verbose=True)
|
test_main(verbose=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -269,6 +269,14 @@ class OpenerDirectorTests(unittest.TestCase):
|
||||||
isinstance(args[1], MockResponse))
|
isinstance(args[1], MockResponse))
|
||||||
|
|
||||||
|
|
||||||
|
def sanepathname2url(path):
|
||||||
|
import urllib
|
||||||
|
urlpath = urllib.pathname2url(path)
|
||||||
|
if os.name == "nt" and urlpath.startswith("///"):
|
||||||
|
urlpath = urlpath[2:]
|
||||||
|
# XXX don't ask me about the mac...
|
||||||
|
return urlpath
|
||||||
|
|
||||||
class HandlerTests(unittest.TestCase):
|
class HandlerTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_ftp(self):
|
def test_ftp(self):
|
||||||
|
@ -323,19 +331,17 @@ class HandlerTests(unittest.TestCase):
|
||||||
h = urllib2.FileHandler()
|
h = urllib2.FileHandler()
|
||||||
o = h.parent = MockOpener()
|
o = h.parent = MockOpener()
|
||||||
|
|
||||||
#from test_support import TESTFN
|
TESTFN = test_support.TESTFN
|
||||||
TESTFN = "test.txt"
|
urlpath = sanepathname2url(os.path.abspath(TESTFN))
|
||||||
towrite = "hello, world\n"
|
towrite = "hello, world\n"
|
||||||
for url in [
|
for url in [
|
||||||
"file://localhost%s/%s" % (os.getcwd(), TESTFN),
|
"file://localhost%s" % urlpath,
|
||||||
"file://%s/%s" % (os.getcwd(), TESTFN),
|
"file://%s" % urlpath,
|
||||||
"file://%s%s/%s" % (socket.gethostbyname('localhost'),
|
"file://%s%s" % (socket.gethostbyname('localhost'), urlpath),
|
||||||
os.getcwd(), TESTFN),
|
"file://%s%s" % (socket.gethostbyname(socket.gethostname()),
|
||||||
"file://%s%s/%s" % (socket.gethostbyname(socket.gethostname()),
|
urlpath),
|
||||||
os.getcwd(), TESTFN),
|
|
||||||
# XXX Windows / Mac format(s), ... ?
|
|
||||||
]:
|
]:
|
||||||
f = open(TESTFN, "w")
|
f = open(TESTFN, "wb")
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
f.write(towrite)
|
f.write(towrite)
|
||||||
|
@ -345,25 +351,21 @@ class HandlerTests(unittest.TestCase):
|
||||||
r = h.file_open(Request(url))
|
r = h.file_open(Request(url))
|
||||||
try:
|
try:
|
||||||
data = r.read()
|
data = r.read()
|
||||||
read_time = time.time()
|
|
||||||
headers = r.info()
|
headers = r.info()
|
||||||
newurl = r.geturl()
|
newurl = r.geturl()
|
||||||
finally:
|
finally:
|
||||||
r.close()
|
r.close()
|
||||||
|
stats = os.stat(TESTFN)
|
||||||
|
modified = rfc822.formatdate(stats.st_mtime)
|
||||||
finally:
|
finally:
|
||||||
os.remove(TESTFN)
|
os.remove(TESTFN)
|
||||||
self.assertEqual(data, towrite)
|
self.assertEqual(data, towrite)
|
||||||
self.assertEqual(headers["Content-type"], "text/plain")
|
self.assertEqual(headers["Content-type"], "text/plain")
|
||||||
self.assertEqual(headers["Content-length"], "13")
|
self.assertEqual(headers["Content-length"], "13")
|
||||||
# Fudge Last-modified string comparison by one second to
|
self.assertEqual(headers["Last-modified"], modified)
|
||||||
# prevent spurious failure on crossing a second boundary while
|
|
||||||
# executing this test.
|
|
||||||
unfudged = rfc822.formatdate(read_time)
|
|
||||||
fudged = rfc822.formatdate(read_time-1)
|
|
||||||
self.assert_(headers["Last-modified"] in [unfudged, fudged])
|
|
||||||
|
|
||||||
for url in [
|
for url in [
|
||||||
"file://localhost:80%s/%s" % (os.getcwd(), TESTFN),
|
"file://localhost:80%s" % urlpath,
|
||||||
# XXXX bug: these fail with socket.gaierror, should be URLError
|
# XXXX bug: these fail with socket.gaierror, should be URLError
|
||||||
## "file://%s:80%s/%s" % (socket.gethostbyname('localhost'),
|
## "file://%s:80%s/%s" % (socket.gethostbyname('localhost'),
|
||||||
## os.getcwd(), TESTFN),
|
## os.getcwd(), TESTFN),
|
||||||
|
@ -371,7 +373,7 @@ class HandlerTests(unittest.TestCase):
|
||||||
## (os.getcwd(), TESTFN),
|
## (os.getcwd(), TESTFN),
|
||||||
]:
|
]:
|
||||||
try:
|
try:
|
||||||
f = open(TESTFN, "w")
|
f = open(TESTFN, "wb")
|
||||||
try:
|
try:
|
||||||
f.write(towrite)
|
f.write(towrite)
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -57,13 +57,15 @@ PyList_New(int size)
|
||||||
{
|
{
|
||||||
PyListObject *op;
|
PyListObject *op;
|
||||||
size_t nbytes;
|
size_t nbytes;
|
||||||
|
int allocated_size = roundupsize(size);
|
||||||
|
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
PyErr_BadInternalCall();
|
PyErr_BadInternalCall();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
nbytes = size * sizeof(PyObject *);
|
nbytes = allocated_size * sizeof(PyObject *);
|
||||||
/* Check for overflow */
|
/* Check for overflow */
|
||||||
if (nbytes / sizeof(PyObject *) != (size_t)size) {
|
if (nbytes / sizeof(PyObject *) != (size_t)allocated_size) {
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
}
|
}
|
||||||
op = PyObject_GC_New(PyListObject, &PyList_Type);
|
op = PyObject_GC_New(PyListObject, &PyList_Type);
|
||||||
|
@ -78,7 +80,7 @@ PyList_New(int size)
|
||||||
if (op->ob_item == NULL) {
|
if (op->ob_item == NULL) {
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
}
|
}
|
||||||
memset(op->ob_item, 0, sizeof(*op->ob_item) * size);
|
memset(op->ob_item, 0, sizeof(*op->ob_item) * allocated_size);
|
||||||
}
|
}
|
||||||
op->ob_size = size;
|
op->ob_size = size;
|
||||||
_PyObject_GC_TRACK(op);
|
_PyObject_GC_TRACK(op);
|
||||||
|
@ -154,6 +156,7 @@ ins1(PyListObject *self, int where, PyObject *v)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
items = self->ob_item;
|
items = self->ob_item;
|
||||||
|
if (roundupsize(self->ob_size) - 1 == self->ob_size || items == NULL)
|
||||||
NRESIZE(items, PyObject *, self->ob_size+1);
|
NRESIZE(items, PyObject *, self->ob_size+1);
|
||||||
if (items == NULL) {
|
if (items == NULL) {
|
||||||
PyErr_NoMemory();
|
PyErr_NoMemory();
|
||||||
|
@ -1878,7 +1881,8 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
|
||||||
saved_ob_size = self->ob_size;
|
saved_ob_size = self->ob_size;
|
||||||
saved_ob_item = self->ob_item;
|
saved_ob_item = self->ob_item;
|
||||||
self->ob_size = 0;
|
self->ob_size = 0;
|
||||||
self->ob_item = empty_ob_item = PyMem_NEW(PyObject *, 0);
|
/* self->ob_item = empty_ob_item = PyMem_NEW(PyObject *, 0); */
|
||||||
|
self->ob_item = empty_ob_item = PyMem_NEW(PyObject *, roundupsize(0));
|
||||||
|
|
||||||
if (keyfunc != NULL) {
|
if (keyfunc != NULL) {
|
||||||
for (i=0 ; i < saved_ob_size ; i++) {
|
for (i=0 ; i < saved_ob_size ; i++) {
|
||||||
|
|
Loading…
Reference in New Issue