Merged revisions 61644,61646-61647,61649-61652,61656-61658,61663,6166… · pythoncapi/cpython@e25f35e · GitHub
Skip to content

Commit e25f35e

Browse files
committed
Merged revisions 61644,61646-61647,61649-61652,61656-61658,61663,61665,61667 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r61644 | trent.nelson | 2008-03-19 22:51:16 +0100 (Mi, 19 Mär 2008) | 1 line Force a clean of the tcltk/tcltk64 directories now that we've completely changed the tcl/tk build environment. ........ r61646 | gregory.p.smith | 2008-03-19 23:23:51 +0100 (Mi, 19 Mär 2008) | 2 lines Improve the error message when the CRCs don't match. ........ r61647 | trent.nelson | 2008-03-19 23:41:10 +0100 (Mi, 19 Mär 2008) | 1 line Comment out tcltk/tcltk64 removal. ........ r61649 | raymond.hettinger | 2008-03-19 23:47:48 +0100 (Mi, 19 Mär 2008) | 1 line Remove unnecessary traceback save/restore pair. ........ r61650 | trent.nelson | 2008-03-19 23:51:42 +0100 (Mi, 19 Mär 2008) | 1 line Bump the SIGALM delay from 3 seconds to 20 seconds, mainly in an effort to see if it fixes the alarm failures in this test experienced by some of the buildbots. ........ r61651 | brett.cannon | 2008-03-20 00:01:17 +0100 (Do, 20 Mär 2008) | 5 lines Make sure that the warnings filter is not reset or changed beyond the current running test file. Closes issue2407. Thanks Jerry Seutter. ........ r61652 | gregory.p.smith | 2008-03-20 00:03:25 +0100 (Do, 20 Mär 2008) | 10 lines Prevent ioctl op codes from being sign extended from int to unsigned long when used on platforms that actually define ioctl as taking an unsigned long. (the BSDs and OS X / Darwin) Adds a unittest for fcntl.ioctl that tests what happens with both positive and negative numbers. This was done because of issue1471 but I'm not able to reproduce -that- problem in the first place on Linux 32bit or 64bit or OS X 10.4 & 10.5 32bit or 64 bit. ........ r61656 | sean.reifschneider | 2008-03-20 01:46:50 +0100 (Do, 20 Mär 2008) | 2 lines Issue python#2143: Fix embedded readline() hang on SSL socket EOF. ........ r61657 | sean.reifschneider | 2008-03-20 01:50:07 +0100 (Do, 20 Mär 2008) | 2 lines Forgot to add NEWS item about smtplib SSL readline hang fix. ........ r61658 | trent.nelson | 2008-03-20 01:58:44 +0100 (Do, 20 Mär 2008) | 1 line Revert r61650; the intent of this commit was to try and address alarm failures on some of the build slaves. As Neal points out, it's called after test_main(), so it's not going to factor into the test when run via regrtest.py (and removes the original functionality that Jeffrey wanted that would kill the test if it took longer than 3 seconds to run when executing it directly during development). ........ r61663 | sean.reifschneider | 2008-03-20 04:20:48 +0100 (Do, 20 Mär 2008) | 2 lines Issue 2188: Documentation hint about disabling proxy detection. ........ r61665 | gregory.p.smith | 2008-03-20 06:41:53 +0100 (Do, 20 Mär 2008) | 7 lines Attempt to fix the Solaris Sparc 10 buildbot. It was failing with an invalid argument error on ioctl. This was caused by the added test_fcntl ioctl test that hard coded 0 as the fd to use. Without a terminal, this fails on solaris. (it passed from the command line on sol 10, both 32 and 64 bit) Also, test_ioctl exists so I moved the test into there where it belongs. ........ r61667 | georg.brandl | 2008-03-20 08:25:55 +0100 (Do, 20 Mär 2008) | 2 lines python#2383: remove obsolete XXX comment in stat.py. ........
1 parent 593cd6b commit e25f35e

12 files changed

Lines changed: 106 additions & 53 deletions

File tree

Doc/library/fcntl.rst

Lines changed: 2 additions & 0 deletions

Doc/library/urllib2.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ The following classes are provided:
179179
Cause requests to go through a proxy. If *proxies* is given, it must be a
180180
dictionary mapping protocol names to URLs of proxies. The default is to read the
181181
list of proxies from the environment variables :envvar:`<protocol>_proxy`.
182+
To disable autodetected proxy pass an empty dictionary.
182183

183184

184185
.. class:: HTTPPasswordMgr()

Lib/bsddb/test/test_1413192.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
import shutil
77
import tempfile
8+
from test.test_support import catch_warning
89
import warnings
10+
911
try:
1012
# For Pythons w/distutils and add-on pybsddb
1113
from bsddb3 import db
@@ -33,12 +35,11 @@ def __init__(self):
3335
del self.the_txn
3436

3537

36-
warnings.filterwarnings('ignore', 'DBTxn aborted in destructor')
37-
try:
38+
with catch_warning():
39+
warnings.filterwarnings('ignore', 'DBTxn aborted in destructor')
3840
context = Context()
3941
del context
40-
finally:
41-
warnings.resetwarnings()
42+
4243

4344
# try not to leave a turd
4445
try:

Lib/gzip.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ def _read_eof(self):
321321
crc32 = read32(self.fileobj)
322322
isize = U32(read32(self.fileobj)) # may exceed 2GB
323323
if U32(crc32) != U32(self.crc):
324-
raise IOError("CRC check failed")
324+
raise IOError("CRC check failed %s != %s" % (hex(U32(crc32)),
325+
hex(U32(self.crc))))
325326
elif isize != LOWU32(self.size):
326327
raise IOError("Incorrect length of data produced")
327328

Lib/smtplib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def readline(self):
174174
chr = None
175175
while chr != b"\n":
176176
chr = self.sslobj.read(1)
177+
if not chr: break
177178
str += chr
178179
return str
179180

Lib/stat.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
Suggested usage: from stat import *
44
"""
55

6-
# XXX Strictly spoken, this module may have to be adapted for each POSIX
7-
# implementation; in practice, however, the numeric constants used by
8-
# stat() are almost universal (even for stat() emulations on non-UNIX
9-
# systems like MS-DOS).
10-
11-
# Indices for stat struct members in tuple returned by os.stat()
6+
# Indices for stat struct members in the tuple returned by os.stat()
127

138
ST_MODE = 0
149
ST_INO = 1

Lib/test/test_fcntl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
OS/2+EMX doesn't support the file locking operations.
44
55
"""
6-
import struct
76
import fcntl
8-
import os, sys
7+
import os
8+
import struct
9+
import sys
910
import unittest
1011
from test.test_support import verbose, TESTFN, unlink, run_unittest
1112

12-
# TODO - Write tests for ioctl(), flock() and lockf().
13-
13+
# TODO - Write tests for flock() and lockf().
1414

1515
def get_lockdata():
1616
if sys.platform.startswith('atheos'):

Lib/test/test_hmac.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ def update(self, v):
211211
def digest(self):
212212
return self._x.digest()
213213

214-
warnings.simplefilter('error', RuntimeWarning)
215-
try:
214+
with test_support.catch_warning():
215+
warnings.simplefilter('error', RuntimeWarning)
216216
try:
217217
hmac.HMAC(b'a', b'b', digestmod=MockCrazyHash)
218218
except RuntimeWarning:
@@ -227,8 +227,6 @@ def digest(self):
227227
pass
228228
else:
229229
self.fail('Expected warning about small block_size')
230-
finally:
231-
warnings.resetwarnings()
232230

233231

234232

Lib/test/test_ioctl.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
except IOError:
1515
raise TestSkipped("Unable to open /dev/tty")
1616

17+
try:
18+
import pty
19+
except ImportError:
20+
pty = None
21+
1722
class IoctlTests(unittest.TestCase):
1823
def test_ioctl(self):
1924
# If this process has been put into the background, TIOCGPGRP returns
@@ -34,6 +39,30 @@ def test_ioctl_mutate(self):
3439
self.assertEquals(r, 0)
3540
self.assert_(rpgrp in ids, "%s not in %s" % (rpgrp, ids))
3641

42+
def test_ioctl_signed_unsigned_code_param(self):
43+
if not pty:
44+
raise TestSkipped('pty module required')
45+
mfd, sfd = pty.openpty()
46+
try:
47+
if termios.TIOCSWINSZ < 0:
48+
set_winsz_opcode_maybe_neg = termios.TIOCSWINSZ
49+
set_winsz_opcode_pos = termios.TIOCSWINSZ & 0xffffffff
50+
else:
51+
set_winsz_opcode_pos = termios.TIOCSWINSZ
52+
set_winsz_opcode_maybe_neg, = struct.unpack("i",
53+
struct.pack("I", termios.TIOCSWINSZ))
54+
55+
# We're just testing that these calls do not raise exceptions.
56+
saved_winsz = fcntl.ioctl(mfd, termios.TIOCGWINSZ, "\0"*8)
57+
our_winsz = struct.pack("HHHH",80,25,0,0)
58+
# test both with a positive and potentially negative ioctl code
59+
new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_pos, our_winsz)
60+
new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_maybe_neg, our_winsz)
61+
fcntl.ioctl(mfd, set_winsz_opcode_maybe_neg, saved_winsz)
62+
finally:
63+
os.close(mfd)
64+
os.close(sfd)
65+
3766
def test_main():
3867
run_unittest(IoctlTests)
3968

Lib/test/test_unicode_file.py

Lines changed: 43 additions & 25 deletions

0 commit comments

Comments
 (0)