[Python-checkins] r76109 - in sandbox/trunk/newgil: Doc/library/datetime.rst Lib/distutils/tests/test_build_py.py Lib/distutils/tests/test_util.py Lib/getpass.py Lib/lib2to3/Grammar.txt Lib/lib2to3/fixes/fix_idioms.py Lib/lib2to3/fixes/fix_map.py Lib/lib2to3/fixes/fix_tuple_params.py Lib/lib2to3/pgen2/pgen.py Lib/lib2to3/pgen2/tokenize.py Lib/lib2to3/pytree.py Lib/lib2to3/tests/test_all_fixers.py Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_parser.py Lib/mailbox.py Lib/test/support.py Lib/test/test_bytes.py Lib/test/test_itertools.py Lib/test/test_mailbox.py Lib/test/test_multibytecodec_support.py Lib/test/test_normalization.py Lib/test/test_shutil.py Lib/test/test_site.py Lib/test/test_wsgiref.py Lib/test/test_xmlrpc_net.py Misc/NEWS Modules/itertoolsmodule.c Modules/termios.c configure configure.in
antoine.pitrou
python-checkins at python.org
Wed Nov 4 21:31:00 CET 2009
Author: antoine.pitrou
Date: Wed Nov 4 21:30:59 2009
New Revision: 76109
Log:
Merged revisions 76010,76013,76017,76020,76026,76030-76032,76036,76040,76043,76048,76055,76063,76068,76072,76076,76084,76088,76090,76094,76097,76103 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r76010 | antoine.pitrou | 2009-11-01 16:59:11 +0100 (dim., 01 nov. 2009) | 3 lines
Fix test skipping in multibyte codec tests
................
r76013 | antoine.pitrou | 2009-11-01 17:13:08 +0100 (dim., 01 nov. 2009) | 8 lines
Blocked revisions 76012 via svnmerge
........
r76012 | antoine.pitrou | 2009-11-01 17:10:47 +0100 (dim., 01 nov. 2009) | 3 lines
Hum, test skipping when the URL isn't reachable hadn't been applied to trunk.
........
................
r76017 | gregory.p.smith | 2009-11-01 19:42:17 +0100 (dim., 01 nov. 2009) | 18 lines
Merged revisions 76000,76016 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76000 | gregory.p.smith | 2009-10-31 14:26:08 -0700 (Sat, 31 Oct 2009) | 7 lines
Fixes issue7208 - getpass would still allow the password to be echoed on
Solaris due to not flushing the input buffer.
This change also incorporates some additional getpass implementation
suggestions for security based on an analysis of getpass.c linked to from the
issue.
........
r76016 | gregory.p.smith | 2009-11-01 10:33:55 -0800 (Sun, 01 Nov 2009) | 2 lines
news entry for r76000
........
................
r76020 | gregory.p.smith | 2009-11-01 20:24:18 +0100 (dim., 01 nov. 2009) | 9 lines
Merged revisions 75999 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75999 | gregory.p.smith | 2009-10-31 14:23:39 -0700 (Sat, 31 Oct 2009) | 2 lines
Define TCSASOFT if the flag exists.
........
................
r76026 | raymond.hettinger | 2009-11-01 21:55:33 +0100 (dim., 01 nov. 2009) | 1 line
Fix exception handling in itertools.izip_longest().
................
r76030 | gregory.p.smith | 2009-11-01 22:09:10 +0100 (dim., 01 nov. 2009) | 9 lines
Merged revisions 76028 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76028 | gregory.p.smith | 2009-11-01 13:02:52 -0800 (Sun, 01 Nov 2009) | 2 lines
issue1115: convert some AC_TRY_RUNs into AC_TRY_COMPILEs.
........
................
r76031 | gregory.p.smith | 2009-11-01 22:10:57 +0100 (dim., 01 nov. 2009) | 2 lines
block r76029
................
r76032 | gregory.p.smith | 2009-11-01 22:11:36 +0100 (dim., 01 nov. 2009) | 2 lines
generated from r76030
................
r76036 | antoine.pitrou | 2009-11-01 22:43:20 +0100 (dim., 01 nov. 2009) | 9 lines
Merged revisions 76033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76033 | antoine.pitrou | 2009-11-01 22:26:14 +0100 (dim., 01 nov. 2009) | 3 lines
test_normalization should skip and not crash when the resource isn't available
........
................
r76040 | antoine.pitrou | 2009-11-01 23:13:48 +0100 (dim., 01 nov. 2009) | 9 lines
Merged revisions 76037 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76037 | antoine.pitrou | 2009-11-01 23:02:03 +0100 (dim., 01 nov. 2009) | 3 lines
Use a custom timeout in test_support.open_urlresource.
........
................
r76043 | tarek.ziade | 2009-11-01 23:38:44 +0100 (dim., 01 nov. 2009) | 9 lines
Merged revisions 76042 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76042 | tarek.ziade | 2009-11-01 23:33:45 +0100 (Sun, 01 Nov 2009) | 1 line
fixed stdout alteration in test_distutils
........
................
r76048 | antoine.pitrou | 2009-11-02 00:55:40 +0100 (lun., 02 nov. 2009) | 9 lines
Merged revisions 76047 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76047 | antoine.pitrou | 2009-11-02 00:54:20 +0100 (lun., 02 nov. 2009) | 3 lines
Fix and improve some assertions in test_site
........
................
r76055 | antoine.pitrou | 2009-11-02 12:36:51 +0100 (lun., 02 nov. 2009) | 13 lines
Merged revisions 76034,76054 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76034 | antoine.pitrou | 2009-11-01 22:29:33 +0100 (dim., 01 nov. 2009) | 3 lines
This should finally fix #6896. Let's watch the buildbots.
........
r76054 | antoine.pitrou | 2009-11-02 12:34:27 +0100 (lun., 02 nov. 2009) | 3 lines
Since r76034 was successful, add a NEWS entry for it.
........
................
r76063 | benjamin.peterson | 2009-11-02 19:16:28 +0100 (lun., 02 nov. 2009) | 77 lines
Merged revisions 76062 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r76062 | benjamin.peterson | 2009-11-02 12:12:12 -0600 (Mon, 02 Nov 2009) | 70 lines
Merged revisions 74359,75081,75088,75213,75278,75303,75427-75428,75734-75736,75865,76059-76061 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r74359 | benjamin.peterson | 2009-08-12 17:23:13 -0500 (Wed, 12 Aug 2009) | 1 line
don't pass the deprecated print_function option
........
r75081 | benjamin.peterson | 2009-09-26 22:02:57 -0500 (Sat, 26 Sep 2009) | 1 line
let 2to3 work with extended iterable unpacking
........
r75088 | benjamin.peterson | 2009-09-27 11:25:21 -0500 (Sun, 27 Sep 2009) | 1 line
look on the type only for __call__
........
r75213 | benjamin.peterson | 2009-10-03 10:09:46 -0500 (Sat, 03 Oct 2009) | 5 lines
revert 75212; it's not correct
People can use isinstance(x, collections.Callable) if they expect objects with
__call__ in their instance dictionaries.
........
r75278 | benjamin.peterson | 2009-10-07 16:25:56 -0500 (Wed, 07 Oct 2009) | 4 lines
fix whitespace problems with fix_idioms #3563
Patch by Joe Amenta.
........
r75303 | benjamin.peterson | 2009-10-09 16:59:11 -0500 (Fri, 09 Oct 2009) | 1 line
port latin-1 and utf-8 cookie improvements
........
r75427 | benjamin.peterson | 2009-10-14 20:35:57 -0500 (Wed, 14 Oct 2009) | 1 line
force floor division
........
r75428 | benjamin.peterson | 2009-10-14 20:39:21 -0500 (Wed, 14 Oct 2009) | 1 line
silence -3 warnings about __hash__
........
r75734 | benjamin.peterson | 2009-10-26 16:25:53 -0500 (Mon, 26 Oct 2009) | 2 lines
warn on map(None, ...) with more than 2 arguments #7203
........
r75735 | benjamin.peterson | 2009-10-26 16:28:25 -0500 (Mon, 26 Oct 2009) | 1 line
remove unused result
........
r75736 | benjamin.peterson | 2009-10-26 16:29:02 -0500 (Mon, 26 Oct 2009) | 1 line
using get() here is a bit pointless
........
r75865 | benjamin.peterson | 2009-10-27 15:49:00 -0500 (Tue, 27 Oct 2009) | 1 line
explain reason for warning
........
r76059 | benjamin.peterson | 2009-11-02 11:43:47 -0600 (Mon, 02 Nov 2009) | 1 line
tuples are no longer used for children
........
r76060 | benjamin.peterson | 2009-11-02 11:55:40 -0600 (Mon, 02 Nov 2009) | 1 line
revert r76059; apparently some fixers rely on Leaf no () for children
........
r76061 | benjamin.peterson | 2009-11-02 12:06:17 -0600 (Mon, 02 Nov 2009) | 1 line
make fix_tuple_params keep the tree valid #7253
........
................
................
r76068 | benjamin.peterson | 2009-11-02 19:30:48 +0100 (lun., 02 nov. 2009) | 24 lines
Merged revisions 76064,76066-76067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r76064 | benjamin.peterson | 2009-11-02 12:16:36 -0600 (Mon, 02 Nov 2009) | 1 line
add space
................
r76066 | benjamin.peterson | 2009-11-02 12:22:53 -0600 (Mon, 02 Nov 2009) | 9 lines
Merged revisions 76065 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r76065 | benjamin.peterson | 2009-11-02 12:21:25 -0600 (Mon, 02 Nov 2009) | 1 line
don't print stuff in tests
........
................
r76067 | benjamin.peterson | 2009-11-02 12:24:57 -0600 (Mon, 02 Nov 2009) | 1 line
enable test_parser in lib2to3
................
................
r76072 | antoine.pitrou | 2009-11-02 21:57:43 +0100 (lun., 02 nov. 2009) | 9 lines
Blocked revisions 76071 via svnmerge
........
r76071 | antoine.pitrou | 2009-11-02 21:47:33 +0100 (lun., 02 nov. 2009) | 4 lines
Add acceptance of long ints to test_memoryio.py
(in preparation for fix of #7249 in 2.6)
........
................
r76076 | skip.montanaro | 2009-11-03 03:44:04 +0100 (mar., 03 nov. 2009) | 1 line
typo (space-o?)
................
r76084 | mark.dickinson | 2009-11-03 17:29:10 +0100 (mar., 03 nov. 2009) | 9 lines
Merged revisions 76082 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76082 | mark.dickinson | 2009-11-03 16:26:14 +0000 (Tue, 03 Nov 2009) | 1 line
Fix doc typo reported by Arfrever.
........
................
r76088 | antoine.pitrou | 2009-11-03 18:13:59 +0100 (mar., 03 nov. 2009) | 3 lines
Since time.xmlrpc.com is unreliable, add another test to test_xmlrpc_net
................
r76090 | antoine.pitrou | 2009-11-03 18:20:10 +0100 (mar., 03 nov. 2009) | 9 lines
Merged revisions 76086 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76086 | antoine.pitrou | 2009-11-03 17:41:20 +0100 (mar., 03 nov. 2009) | 3 lines
Try to make test_wsgiref less fragile against environment changes by other tests
........
................
r76094 | georg.brandl | 2009-11-03 19:24:38 +0100 (mar., 03 nov. 2009) | 9 lines
Recorded merge of revisions 76075 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76075 | skip.montanaro | 2009-11-03 02:43:59 +0000 (Di, 03 Nov 2009) | 1 line
typo (space-o?)
........
................
r76097 | georg.brandl | 2009-11-03 19:35:33 +0100 (mar., 03 nov. 2009) | 8 lines
Blocked revisions 76095 via svnmerge
........
r76095 | georg.brandl | 2009-11-03 18:34:27 +0000 (Di, 03 Nov 2009) | 1 line
#7256: add versionadded tags for functions copied from cgi.
........
................
r76103 | antoine.pitrou | 2009-11-04 01:57:15 +0100 (mer., 04 nov. 2009) | 9 lines
Merged revisions 76101 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76101 | antoine.pitrou | 2009-11-04 01:50:26 +0100 (mer., 04 nov. 2009) | 3 lines
Make test_shutil clean up after itself
........
................
Modified:
sandbox/trunk/newgil/ (props changed)
sandbox/trunk/newgil/Doc/library/datetime.rst
sandbox/trunk/newgil/Lib/distutils/tests/test_build_py.py
sandbox/trunk/newgil/Lib/distutils/tests/test_util.py
sandbox/trunk/newgil/Lib/getpass.py
sandbox/trunk/newgil/Lib/lib2to3/Grammar.txt
sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_idioms.py
sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_map.py
sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_tuple_params.py
sandbox/trunk/newgil/Lib/lib2to3/pgen2/pgen.py
sandbox/trunk/newgil/Lib/lib2to3/pgen2/tokenize.py
sandbox/trunk/newgil/Lib/lib2to3/pytree.py
sandbox/trunk/newgil/Lib/lib2to3/tests/test_all_fixers.py
sandbox/trunk/newgil/Lib/lib2to3/tests/test_fixers.py
sandbox/trunk/newgil/Lib/lib2to3/tests/test_parser.py
sandbox/trunk/newgil/Lib/mailbox.py
sandbox/trunk/newgil/Lib/test/support.py
sandbox/trunk/newgil/Lib/test/test_bytes.py
sandbox/trunk/newgil/Lib/test/test_itertools.py
sandbox/trunk/newgil/Lib/test/test_mailbox.py
sandbox/trunk/newgil/Lib/test/test_multibytecodec_support.py
sandbox/trunk/newgil/Lib/test/test_normalization.py
sandbox/trunk/newgil/Lib/test/test_shutil.py
sandbox/trunk/newgil/Lib/test/test_site.py
sandbox/trunk/newgil/Lib/test/test_wsgiref.py
sandbox/trunk/newgil/Lib/test/test_xmlrpc_net.py
sandbox/trunk/newgil/Misc/NEWS
sandbox/trunk/newgil/Modules/itertoolsmodule.c
sandbox/trunk/newgil/Modules/termios.c
sandbox/trunk/newgil/configure
sandbox/trunk/newgil/configure.in
Modified: sandbox/trunk/newgil/Doc/library/datetime.rst
==============================================================================
--- sandbox/trunk/newgil/Doc/library/datetime.rst (original)
+++ sandbox/trunk/newgil/Doc/library/datetime.rst Wed Nov 4 21:30:59 2009
@@ -469,7 +469,8 @@
Return a 3-tuple, (ISO year, ISO week number, ISO weekday).
The ISO calendar is a widely used variant of the Gregorian calendar. See
- http://www.phys.uu.nl/ vgent/calendar/isocalendar.htm for a good explanation.
+ http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm for a good
+ explanation.
The ISO year consists of 52 or 53 full weeks, and where a week starts on a
Monday and ends on a Sunday. The first week of an ISO year is the first
Modified: sandbox/trunk/newgil/Lib/distutils/tests/test_build_py.py
==============================================================================
--- sandbox/trunk/newgil/Lib/distutils/tests/test_build_py.py (original)
+++ sandbox/trunk/newgil/Lib/distutils/tests/test_build_py.py Wed Nov 4 21:30:59 2009
@@ -69,6 +69,7 @@
open(os.path.join(testdir, "testfile"), "w").close()
os.chdir(sources)
+ old_stdout = sys.stdout
sys.stdout = io.StringIO()
try:
@@ -87,7 +88,7 @@
finally:
# Restore state.
os.chdir(cwd)
- sys.stdout = sys.__stdout__
+ sys.stdout = old_stdout
def test_dont_write_bytecode(self):
# makes sure byte_compile is not used
Modified: sandbox/trunk/newgil/Lib/distutils/tests/test_util.py
==============================================================================
--- sandbox/trunk/newgil/Lib/distutils/tests/test_util.py (original)
+++ sandbox/trunk/newgil/Lib/distutils/tests/test_util.py Wed Nov 4 21:30:59 2009
@@ -60,6 +60,8 @@
util.find_executable = self._find_executable
self._exes = {}
self.old_popen = subprocess.Popen
+ self.old_stdout = sys.stdout
+ self.old_stderr = sys.stderr
FakePopen.test_class = self
subprocess.Popen = FakePopen
@@ -79,6 +81,8 @@
sysconfig._config_vars = copy(self._config_vars)
util.find_executable = self.old_find_executable
subprocess.Popen = self.old_popen
+ sys.old_stdout = self.old_stdout
+ sys.old_stderr = self.old_stderr
super(UtilTestCase, self).tearDown()
def _set_uname(self, uname):
Modified: sandbox/trunk/newgil/Lib/getpass.py
==============================================================================
--- sandbox/trunk/newgil/Lib/getpass.py (original)
+++ sandbox/trunk/newgil/Lib/getpass.py Wed Nov 4 21:30:59 2009
@@ -62,12 +62,16 @@
try:
old = termios.tcgetattr(fd) # a copy to save
new = old[:]
- new[3] &= ~termios.ECHO # 3 == 'lflags'
+ new[3] &= ~(termios.ECHO|termios.ISIG) # 3 == 'lflags'
+ tcsetattr_flags = termios.TCSAFLUSH
+ if hasattr(termios, 'TCSASOFT'):
+ tcsetattr_flags |= termios.TCSASOFT
try:
- termios.tcsetattr(fd, termios.TCSADRAIN, new)
+ termios.tcsetattr(fd, tcsetattr_flags, new)
passwd = _raw_input(prompt, stream, input=input)
finally:
- termios.tcsetattr(fd, termios.TCSADRAIN, old)
+ termios.tcsetattr(fd, tcsetattr_flags, old)
+ stream.flush() # issue7208
except termios.error as e:
if passwd is not None:
# _raw_input succeeded. The final tcsetattr failed. Reraise
@@ -124,6 +128,7 @@
if prompt:
stream.write(prompt)
stream.flush()
+ # NOTE: The Python C API calls flockfile() (and unlock) during readline.
line = input.readline()
if not line:
raise EOFError
Modified: sandbox/trunk/newgil/Lib/lib2to3/Grammar.txt
==============================================================================
--- sandbox/trunk/newgil/Lib/lib2to3/Grammar.txt (original)
+++ sandbox/trunk/newgil/Lib/lib2to3/Grammar.txt Wed Nov 4 21:30:59 2009
@@ -53,8 +53,9 @@
simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
small_stmt: (expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt |
import_stmt | global_stmt | exec_stmt | assert_stmt)
-expr_stmt: testlist (augassign (yield_expr|testlist) |
- ('=' (yield_expr|testlist))*)
+expr_stmt: testlist_star_expr (augassign (yield_expr|testlist) |
+ ('=' (yield_expr|testlist_star_expr))*)
+testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [',']
augassign: ('+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' |
'<<=' | '>>=' | '**=' | '//=')
# For normal assignments, additional restrictions enforced by the interpreter
@@ -112,6 +113,7 @@
not_test: 'not' not_test | comparison
comparison: expr (comp_op expr)*
comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not'
+star_expr: '*' expr
expr: xor_expr ('|' xor_expr)*
xor_expr: and_expr ('^' and_expr)*
and_expr: shift_expr ('&' shift_expr)*
@@ -125,14 +127,14 @@
'{' [dictsetmaker] '}' |
'`' testlist1 '`' |
NAME | NUMBER | STRING+ | '.' '.' '.')
-listmaker: test ( comp_for | (',' test)* [','] )
-testlist_gexp: test ( comp_for | (',' test)* [','] )
+listmaker: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] )
+testlist_gexp: test ( comp_for | (',' (test|star_expr))* [','] )
lambdef: 'lambda' [varargslist] ':' test
trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
subscriptlist: subscript (',' subscript)* [',']
subscript: test | [test] ':' [test] [sliceop]
sliceop: ':' [test]
-exprlist: expr (',' expr)* [',']
+exprlist: (expr|star_expr) (',' (expr|star_expr))* [',']
testlist: test (',' test)* [',']
dictsetmaker: ( (test ':' test (comp_for | (',' test ':' test)* [','])) |
(test (comp_for | (',' test)* [','])) )
Modified: sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_idioms.py
==============================================================================
--- sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_idioms.py (original)
+++ sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_idioms.py Wed Nov 4 21:30:59 2009
@@ -29,7 +29,7 @@
# Local imports
from .. import fixer_base
-from ..fixer_util import Call, Comma, Name, Node, syms
+from ..fixer_util import Call, Comma, Name, Node, BlankLine, syms
CMP = "(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)"
TYPE = "power< 'type' trailer< '(' x=any ')' > >"
@@ -130,5 +130,24 @@
else:
raise RuntimeError("should not have reached here")
sort_stmt.remove()
- if next_stmt:
- next_stmt[0].prefix = sort_stmt.prefix
+
+ btwn = sort_stmt.prefix
+ # Keep any prefix lines between the sort_stmt and the list_call and
+ # shove them right after the sorted() call.
+ if "\n" in btwn:
+ if next_stmt:
+ # The new prefix should be everything from the sort_stmt's
+ # prefix up to the last newline, then the old prefix after a new
+ # line.
+ prefix_lines = (btwn.rpartition("\n")[0], next_stmt[0].prefix)
+ next_stmt[0].prefix = "\n".join(prefix_lines)
+ else:
+ assert list_call.parent
+ assert list_call.next_sibling is None
+ # Put a blank line after list_call and set its prefix.
+ end_line = BlankLine()
+ list_call.parent.append_child(end_line)
+ assert list_call.next_sibling is end_line
+ # The new prefix should be everything up to the first new line
+ # of sort_stmt's prefix.
+ end_line.prefix = btwn.rpartition("\n")[0]
Modified: sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_map.py
==============================================================================
--- sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_map.py (original)
+++ sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_map.py Wed Nov 4 21:30:59 2009
@@ -49,8 +49,7 @@
>
|
power<
- 'map'
- args=trailer< '(' [any] ')' >
+ 'map' trailer< '(' [arglist=any] ')' >
>
"""
@@ -66,13 +65,22 @@
new.prefix = ""
new = Call(Name("list"), [new])
elif "map_lambda" in results:
- new = ListComp(results.get("xp").clone(),
- results.get("fp").clone(),
- results.get("it").clone())
+ new = ListComp(results["xp"].clone(),
+ results["fp"].clone(),
+ results["it"].clone())
else:
if "map_none" in results:
new = results["arg"].clone()
else:
+ if "arglist" in results:
+ args = results["arglist"]
+ if args.type == syms.arglist and \
+ args.children[0].type == token.NAME and \
+ args.children[0].value == "None":
+ self.warning(node, "cannot convert map(None, ...) "
+ "with multiple arguments because map() "
+ "now truncates to the shortest sequence")
+ return
if in_special_context(node):
return None
new = node.clone()
Modified: sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_tuple_params.py
==============================================================================
--- sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_tuple_params.py (original)
+++ sandbox/trunk/newgil/Lib/lib2to3/fixes/fix_tuple_params.py Wed Nov 4 21:30:59 2009
@@ -96,6 +96,8 @@
new_lines[0].prefix = indent
after = start + 1
+ for line in new_lines:
+ line.parent = suite[0]
suite[0].children[after:after] = new_lines
for i in range(after+1, after+len(new_lines)+1):
suite[0].children[i].prefix = indent
Modified: sandbox/trunk/newgil/Lib/lib2to3/pgen2/pgen.py
==============================================================================
--- sandbox/trunk/newgil/Lib/lib2to3/pgen2/pgen.py (original)
+++ sandbox/trunk/newgil/Lib/lib2to3/pgen2/pgen.py Wed Nov 4 21:30:59 2009
@@ -379,6 +379,8 @@
return False
return True
+ __hash__ = None # For Py3 compatibility.
+
def generate_grammar(filename="Grammar.txt"):
p = ParserGenerator(filename)
return p.make_grammar()
Modified: sandbox/trunk/newgil/Lib/lib2to3/pgen2/tokenize.py
==============================================================================
--- sandbox/trunk/newgil/Lib/lib2to3/pgen2/tokenize.py (original)
+++ sandbox/trunk/newgil/Lib/lib2to3/pgen2/tokenize.py Wed Nov 4 21:30:59 2009
@@ -231,6 +231,17 @@
cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
+def _get_normal_name(orig_enc):
+ """Imitates get_normal_name in tokenizer.c."""
+ # Only care about the first 12 characters.
+ enc = orig_enc[:12].lower().replace("_", "-")
+ if enc == "utf-8" or enc.startswith("utf-8-"):
+ return "utf-8"
+ if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or \
+ enc.startswith(("latin-1-", "iso-8859-1-", "iso-latin-1-")):
+ return "iso-8859-1"
+ return orig_enc
+
def detect_encoding(readline):
"""
The detect_encoding() function is used to detect the encoding that should
@@ -265,7 +276,7 @@
matches = cookie_re.findall(line_string)
if not matches:
return None
- encoding = matches[0]
+ encoding = _get_normal_name(matches[0])
try:
codec = lookup(encoding)
except LookupError:
@@ -375,7 +386,7 @@
column = 0
while pos < max: # measure leading whitespace
if line[pos] == ' ': column = column + 1
- elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize
+ elif line[pos] == '\t': column = (column//tabsize + 1)*tabsize
elif line[pos] == '\f': column = 0
else: break
pos = pos + 1
Modified: sandbox/trunk/newgil/Lib/lib2to3/pytree.py
==============================================================================
--- sandbox/trunk/newgil/Lib/lib2to3/pytree.py (original)
+++ sandbox/trunk/newgil/Lib/lib2to3/pytree.py Wed Nov 4 21:30:59 2009
@@ -63,6 +63,8 @@
return NotImplemented
return self._eq(other)
+ __hash__ = None # For Py3 compatibility.
+
def __ne__(self, other):
"""
Compare two nodes for inequality.
Modified: sandbox/trunk/newgil/Lib/lib2to3/tests/test_all_fixers.py
==============================================================================
--- sandbox/trunk/newgil/Lib/lib2to3/tests/test_all_fixers.py (original)
+++ sandbox/trunk/newgil/Lib/lib2to3/tests/test_all_fixers.py Wed Nov 4 21:30:59 2009
@@ -16,10 +16,8 @@
class Test_all(support.TestCase):
def setUp(self):
- options = {"print_function" : False}
- self.refactor = support.get_refactorer(options=options)
+ self.refactor = support.get_refactorer()
def test_all_project_files(self):
for filepath in support.all_project_files():
- print("Fixing %s..." % filepath)
self.refactor.refactor_file(filepath)
Modified: sandbox/trunk/newgil/Lib/lib2to3/tests/test_fixers.py
==============================================================================
--- sandbox/trunk/newgil/Lib/lib2to3/tests/test_fixers.py (original)
+++ sandbox/trunk/newgil/Lib/lib2to3/tests/test_fixers.py Wed Nov 4 21:30:59 2009
@@ -339,6 +339,12 @@
a = "from functools import reduce\nreduce(a, b, c)"
self.check(b, a)
+ def test_bug_7253(self):
+ # fix_tuple_params was being bad and orphaning nodes in the tree.
+ b = "def x(arg): reduce(sum, [])"
+ a = "from functools import reduce\ndef x(arg): reduce(sum, [])"
+ self.check(b, a)
+
def test_call_with_lambda(self):
b = "reduce(lambda x, y: x + y, seq)"
a = "from functools import reduce\nreduce(lambda x, y: x + y, seq)"
@@ -2834,6 +2840,11 @@
a = """x = list(map(f, 'abc')) # foo"""
self.check(b, a)
+ def test_None_with_multiple_arguments(self):
+ s = """x = map(None, a, b, c)"""
+ self.warns_unchanged(s, "cannot convert map(None, ...) with "
+ "multiple arguments")
+
def test_map_basic(self):
b = """x = map(f, 'abc')"""
a = """x = list(map(f, 'abc'))"""
@@ -2847,10 +2858,6 @@
a = """x = list('abc')"""
self.check(b, a)
- b = """x = map(None, 'abc', 'def')"""
- a = """x = list(map(None, 'abc', 'def'))"""
- self.check(b, a)
-
b = """x = map(lambda x: x+1, range(4))"""
a = """x = [x+1 for x in range(4)]"""
self.check(b, a)
@@ -3238,6 +3245,46 @@
"""
self.check(b, a)
+ b = r"""
+ try:
+ m = list(s)
+ m.sort()
+ except: pass
+ """
+
+ a = r"""
+ try:
+ m = sorted(s)
+ except: pass
+ """
+ self.check(b, a)
+
+ b = r"""
+ try:
+ m = list(s)
+ # foo
+ m.sort()
+ except: pass
+ """
+
+ a = r"""
+ try:
+ m = sorted(s)
+ # foo
+ except: pass
+ """
+ self.check(b, a)
+
+ b = r"""
+ m = list(s)
+ # more comments
+ m.sort()"""
+
+ a = r"""
+ m = sorted(s)
+ # more comments"""
+ self.check(b, a)
+
def test_sort_simple_expr(self):
b = """
v = t
Modified: sandbox/trunk/newgil/Lib/lib2to3/tests/test_parser.py
==============================================================================
--- sandbox/trunk/newgil/Lib/lib2to3/tests/test_parser.py (original)
+++ sandbox/trunk/newgil/Lib/lib2to3/tests/test_parser.py Wed Nov 4 21:30:59 2009
@@ -147,7 +147,6 @@
def test_all_project_files(self):
for filepath in support.all_project_files():
- print("Parsing %s..." % filepath)
with open(filepath, "rb") as fp:
encoding = tokenize.detect_encoding(fp.readline)[0]
fp.seek(0)
@@ -161,6 +160,11 @@
if diff(filepath, new):
self.fail("Idempotency failed: %s" % filepath)
+ def test_extended_unpacking(self):
+ driver.parse_string("a, *b, c = x\n")
+ driver.parse_string("[*a, b] = x\n")
+ driver.parse_string("(z, *y, w) = m\n")
+ driver.parse_string("for *z, m in d: pass\n")
class TestLiterals(GrammarTest):
Modified: sandbox/trunk/newgil/Lib/mailbox.py
==============================================================================
--- sandbox/trunk/newgil/Lib/mailbox.py (original)
+++ sandbox/trunk/newgil/Lib/mailbox.py Wed Nov 4 21:30:59 2009
@@ -234,6 +234,9 @@
raise NoSuchMailboxError(self._path)
self._toc = {}
self._last_read = None # Records last time we read cur/new
+ # NOTE: we manually invalidate _last_read each time we do any
+ # modifications ourselves, otherwise we might get tripped up by
+ # bogus mtime behaviour on some systems (see issue #6896).
def add(self, message):
"""Add message and return assigned key."""
@@ -267,11 +270,15 @@
raise
if isinstance(message, MaildirMessage):
os.utime(dest, (os.path.getatime(dest), message.get_date()))
+ # Invalidate cached toc
+ self._last_read = None
return uniq
def remove(self, key):
"""Remove the keyed message; raise KeyError if it doesn't exist."""
os.remove(os.path.join(self._path, self._lookup(key)))
+ # Invalidate cached toc (only on success)
+ self._last_read = None
def discard(self, key):
"""If the keyed message exists, remove it."""
@@ -306,6 +313,8 @@
if isinstance(message, MaildirMessage):
os.utime(new_path, (os.path.getatime(new_path),
message.get_date()))
+ # Invalidate cached toc
+ self._last_read = None
def get_message(self, key):
"""Return a Message representation or raise a KeyError."""
@@ -360,7 +369,9 @@
def flush(self):
"""Write any pending changes to disk."""
- return # Maildir changes are always written immediately.
+ # Maildir changes are always written immediately, so there's nothing
+ # to do except invalidate our cached toc.
+ self._last_read = None
def lock(self):
"""Lock the mailbox."""
Modified: sandbox/trunk/newgil/Lib/test/support.py
==============================================================================
--- sandbox/trunk/newgil/Lib/test/support.py (original)
+++ sandbox/trunk/newgil/Lib/test/support.py Wed Nov 4 21:30:59 2009
@@ -458,10 +458,17 @@
return open(fn, *args, **kw)
print('\tfetching %s ...' % url, file=get_original_stdout())
- fn, _ = urllib.request.urlretrieve(url, fn)
+ f = urllib.request.urlopen(url, timeout=15)
+ try:
+ with open(fn, "wb") as out:
+ s = f.read()
+ while s:
+ out.write(s)
+ s = f.read()
+ finally:
+ f.close()
return open(fn, *args, **kw)
-
class WarningsRecorder(object):
"""Convenience wrapper for the warnings list returned on
entry to the warnings.catch_warnings() context manager.
Modified: sandbox/trunk/newgil/Lib/test/test_bytes.py
==============================================================================
--- sandbox/trunk/newgil/Lib/test/test_bytes.py (original)
+++ sandbox/trunk/newgil/Lib/test/test_bytes.py Wed Nov 4 21:30:59 2009
@@ -935,7 +935,7 @@
self.assertRaises(BytesWarning, operator.eq, bytearray(b''), '')
self.assertRaises(BytesWarning, operator.ne, bytearray(b''), '')
else:
- # raise test.support.TestSkipped("BytesWarning is needed for this test: use -bb option")
+ # self.skipTest("BytesWarning is needed for this test: use -bb option")
pass
# Optimizations:
Modified: sandbox/trunk/newgil/Lib/test/test_itertools.py
==============================================================================
--- sandbox/trunk/newgil/Lib/test/test_itertools.py (original)
+++ sandbox/trunk/newgil/Lib/test/test_itertools.py Wed Nov 4 21:30:59 2009
@@ -581,6 +581,46 @@
ids = list(map(id, list(zip_longest('abc', 'def'))))
self.assertEqual(len(dict.fromkeys(ids)), len(ids))
+ def test_bug_7244(self):
+
+ class Repeater:
+ # this class is similar to itertools.repeat
+ def __init__(self, o, t, e):
+ self.o = o
+ self.t = int(t)
+ self.e = e
+ def __iter__(self): # its iterator is itself
+ return self
+ def __next__(self):
+ if self.t > 0:
+ self.t -= 1
+ return self.o
+ else:
+ raise self.e
+
+ # Formerly this code in would fail in debug mode
+ # with Undetected Error and Stop Iteration
+ r1 = Repeater(1, 3, StopIteration)
+ r2 = Repeater(2, 4, StopIteration)
+ def run(r1, r2):
+ result = []
+ for i, j in zip_longest(r1, r2, fillvalue=0):
+ with support.captured_output('stdout'):
+ print((i, j))
+ result.append((i, j))
+ return result
+ self.assertEqual(run(r1, r2), [(1,2), (1,2), (1,2), (0,2)])
+
+ # Formerly, the RuntimeError would be lost
+ # and StopIteration would stop as expected
+ r1 = Repeater(1, 3, RuntimeError)
+ r2 = Repeater(2, 4, StopIteration)
+ it = zip_longest(r1, r2, fillvalue=0)
+ self.assertEqual(next(it), (1, 2))
+ self.assertEqual(next(it), (1, 2))
+ self.assertEqual(next(it), (1, 2))
+ self.assertRaises(RuntimeError, next, it)
+
def test_product(self):
for args, result in [
([], [()]), # zero iterables
Modified: sandbox/trunk/newgil/Lib/test/test_mailbox.py
==============================================================================
--- sandbox/trunk/newgil/Lib/test/test_mailbox.py (original)
+++ sandbox/trunk/newgil/Lib/test/test_mailbox.py Wed Nov 4 21:30:59 2009
@@ -673,6 +673,9 @@
self.assertEqual(self._box._lookup(key0), os.path.join('new', key0))
os.remove(os.path.join(self._path, 'new', key0))
self.assertEqual(self._box._toc, {key0: os.path.join('new', key0)})
+ # Be sure that the TOC is read back from disk (see issue #6896
+ # about bad mtime behaviour on some systems).
+ self._box.flush()
self.assertRaises(KeyError, lambda: self._box._lookup(key0))
self.assertEqual(self._box._toc, {})
Modified: sandbox/trunk/newgil/Lib/test/test_multibytecodec_support.py
==============================================================================
--- sandbox/trunk/newgil/Lib/test/test_multibytecodec_support.py (original)
+++ sandbox/trunk/newgil/Lib/test/test_multibytecodec_support.py Wed Nov 4 21:30:59 2009
@@ -279,7 +279,7 @@
try:
self.open_mapping_file() # test it to report the error early
except IOError:
- raise support.TestSkipped("Could not retrieve "+self.mapfileurl)
+ self.skipTest("Could not retrieve "+self.mapfileurl)
def open_mapping_file(self):
return support.open_urlresource(self.mapfileurl)
Modified: sandbox/trunk/newgil/Lib/test/test_normalization.py
==============================================================================
--- sandbox/trunk/newgil/Lib/test/test_normalization.py (original)
+++ sandbox/trunk/newgil/Lib/test/test_normalization.py Wed Nov 4 21:30:59 2009
@@ -42,6 +42,11 @@
class NormalizationTest(unittest.TestCase):
def test_main(self):
part1_data = {}
+ # Hit the exception early
+ try:
+ open_urlresource(TESTDATAURL, encoding="utf-8")
+ except IOError:
+ self.skipTest("Could not retrieve " + TESTDATAURL)
for line in open_urlresource(TESTDATAURL, encoding="utf-8"):
if '#' in line:
line = line.split('#')[0]
@@ -97,8 +102,6 @@
def test_main():
- # Skip the test early if the 'urlfetch' resource is not enabled.
- open_urlresource(TESTDATAURL)
run_unittest(NormalizationTest)
if __name__ == "__main__":
Modified: sandbox/trunk/newgil/Lib/test/test_shutil.py
==============================================================================
--- sandbox/trunk/newgil/Lib/test/test_shutil.py (original)
+++ sandbox/trunk/newgil/Lib/test/test_shutil.py Wed Nov 4 21:30:59 2009
@@ -118,7 +118,7 @@
if os.path.exists(path):
os.remove(path)
for path in (src_dir,
- os.path.abspath(os.path.join(dst_dir, os.path.pardir))
+ os.path.dirname(dst_dir)
):
if os.path.exists(path):
shutil.rmtree(path)
@@ -140,65 +140,69 @@
join = os.path.join
exists = os.path.exists
src_dir = tempfile.mkdtemp()
- dst_dir = join(tempfile.mkdtemp(), 'destination')
- write_data(join(src_dir, 'test.txt'), '123')
- write_data(join(src_dir, 'test.tmp'), '123')
- os.mkdir(join(src_dir, 'test_dir'))
- write_data(join(src_dir, 'test_dir', 'test.txt'), '456')
- os.mkdir(join(src_dir, 'test_dir2'))
- write_data(join(src_dir, 'test_dir2', 'test.txt'), '456')
- os.mkdir(join(src_dir, 'test_dir2', 'subdir'))
- os.mkdir(join(src_dir, 'test_dir2', 'subdir2'))
- write_data(join(src_dir, 'test_dir2', 'subdir', 'test.txt'), '456')
- write_data(join(src_dir, 'test_dir2', 'subdir2', 'test.py'), '456')
+ try:
+ dst_dir = join(tempfile.mkdtemp(), 'destination')
+ write_data(join(src_dir, 'test.txt'), '123')
+ write_data(join(src_dir, 'test.tmp'), '123')
+ os.mkdir(join(src_dir, 'test_dir'))
+ write_data(join(src_dir, 'test_dir', 'test.txt'), '456')
+ os.mkdir(join(src_dir, 'test_dir2'))
+ write_data(join(src_dir, 'test_dir2', 'test.txt'), '456')
+ os.mkdir(join(src_dir, 'test_dir2', 'subdir'))
+ os.mkdir(join(src_dir, 'test_dir2', 'subdir2'))
+ write_data(join(src_dir, 'test_dir2', 'subdir', 'test.txt'), '456')
+ write_data(join(src_dir, 'test_dir2', 'subdir2', 'test.py'), '456')
- # testing glob-like patterns
- try:
- patterns = shutil.ignore_patterns('*.tmp', 'test_dir2')
- shutil.copytree(src_dir, dst_dir, ignore=patterns)
- # checking the result: some elements should not be copied
- self.assertTrue(exists(join(dst_dir, 'test.txt')))
- self.assertTrue(not exists(join(dst_dir, 'test.tmp')))
- self.assertTrue(not exists(join(dst_dir, 'test_dir2')))
- finally:
- if os.path.exists(dst_dir):
- shutil.rmtree(dst_dir)
- try:
- patterns = shutil.ignore_patterns('*.tmp', 'subdir*')
- shutil.copytree(src_dir, dst_dir, ignore=patterns)
- # checking the result: some elements should not be copied
- self.assertTrue(not exists(join(dst_dir, 'test.tmp')))
- self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir2')))
- self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir')))
- finally:
- if os.path.exists(dst_dir):
- shutil.rmtree(dst_dir)
+ # testing glob-like patterns
+ try:
+ patterns = shutil.ignore_patterns('*.tmp', 'test_dir2')
+ shutil.copytree(src_dir, dst_dir, ignore=patterns)
+ # checking the result: some elements should not be copied
+ self.assertTrue(exists(join(dst_dir, 'test.txt')))
+ self.assertTrue(not exists(join(dst_dir, 'test.tmp')))
+ self.assertTrue(not exists(join(dst_dir, 'test_dir2')))
+ finally:
+ if os.path.exists(dst_dir):
+ shutil.rmtree(dst_dir)
+ try:
+ patterns = shutil.ignore_patterns('*.tmp', 'subdir*')
+ shutil.copytree(src_dir, dst_dir, ignore=patterns)
+ # checking the result: some elements should not be copied
+ self.assertTrue(not exists(join(dst_dir, 'test.tmp')))
+ self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir2')))
+ self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir')))
+ finally:
+ if os.path.exists(dst_dir):
+ shutil.rmtree(dst_dir)
- # testing callable-style
- try:
- def _filter(src, names):
- res = []
- for name in names:
- path = os.path.join(src, name)
-
- if (os.path.isdir(path) and
- path.split()[-1] == 'subdir'):
- res.append(name)
- elif os.path.splitext(path)[-1] in ('.py'):
- res.append(name)
- return res
-
- shutil.copytree(src_dir, dst_dir, ignore=_filter)
-
- # checking the result: some elements should not be copied
- self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir2',
- 'test.py')))
- self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir')))
+ # testing callable-style
+ try:
+ def _filter(src, names):
+ res = []
+ for name in names:
+ path = os.path.join(src, name)
+
+ if (os.path.isdir(path) and
+ path.split()[-1] == 'subdir'):
+ res.append(name)
+ elif os.path.splitext(path)[-1] in ('.py'):
+ res.append(name)
+ return res
+
+ shutil.copytree(src_dir, dst_dir, ignore=_filter)
+
+ # checking the result: some elements should not be copied
+ self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir2',
+ 'test.py')))
+ self.assertTrue(not exists(join(dst_dir, 'test_dir2', 'subdir')))
+ finally:
+ if os.path.exists(dst_dir):
+ shutil.rmtree(dst_dir)
finally:
- if os.path.exists(dst_dir):
- shutil.rmtree(dst_dir)
+ shutil.rmtree(src_dir)
+ shutil.rmtree(os.path.dirname(dst_dir))
if hasattr(os, "symlink"):
def test_dont_copy_file_onto_link_to_itself(self):
Modified: sandbox/trunk/newgil/Lib/test/test_site.py
==============================================================================
--- sandbox/trunk/newgil/Lib/test/test_site.py (original)
+++ sandbox/trunk/newgil/Lib/test/test_site.py Wed Nov 4 21:30:59 2009
@@ -70,9 +70,9 @@
def pth_file_tests(self, pth_file):
"""Contain common code for testing results of reading a .pth file"""
self.assertTrue(pth_file.imported in sys.modules,
- "%s not in sys.path" % pth_file.imported)
- self.assertTrue(site.makepath(pth_file.good_dir_path)[0] in sys.path)
- self.assertTrue(not os.path.exists(pth_file.bad_dir_path))
+ "%s not in sys.modules" % pth_file.imported)
+ self.assertIn(site.makepath(pth_file.good_dir_path)[0], sys.path)
+ self.assertFalse(os.path.exists(pth_file.bad_dir_path))
def test_addpackage(self):
# Make sure addpackage() imports if the line starts with 'import',
@@ -104,7 +104,7 @@
def test_s_option(self):
usersite = site.USER_SITE
- self.assertTrue(usersite in sys.path)
+ self.assertIn(usersite, sys.path)
rc = subprocess.call([sys.executable, '-c',
'import sys; sys.exit(%r in sys.path)' % usersite])
@@ -139,7 +139,8 @@
site.USER_BASE = None
with EnvironmentVarGuard() as environ:
environ['PYTHONUSERBASE'] = 'xoxo'
- self.assertTrue(site.getuserbase().startswith('xoxo'))
+ self.assertTrue(site.getuserbase().startswith('xoxo'),
+ site.getuserbase())
def test_getusersitepackages(self):
site.USER_SITE = None
@@ -148,14 +149,14 @@
# the call sets USER_BASE *and* USER_SITE
self.assertEquals(site.USER_SITE, user_site)
- self.assertTrue(user_site.startswith(site.USER_BASE))
+ self.assertTrue(user_site.startswith(site.USER_BASE), user_site)
def test_getsitepackages(self):
site.PREFIXES = ['xoxo']
dirs = site.getsitepackages()
if sys.platform in ('os2emx', 'riscos'):
- self.assertTrue(len(dirs), 1)
+ self.assertEqual(len(dirs), 1)
wanted = os.path.join('xoxo', 'Lib', 'site-packages')
self.assertEquals(dirs[0], wanted)
elif os.sep == '/':
@@ -175,7 +176,7 @@
if sys.platform == "darwin":
site.PREFIXES = ['Python.framework']
dirs = site.getsitepackages()
- self.assertTrue(len(dirs), 4)
+ self.assertEqual(len(dirs), 4)
wanted = os.path.join('~', 'Library', 'Python',
sys.version[:3], 'site-packages')
self.assertEquals(dirs[2], os.path.expanduser(wanted))
Modified: sandbox/trunk/newgil/Lib/test/test_wsgiref.py
==============================================================================
--- sandbox/trunk/newgil/Lib/test/test_wsgiref.py (original)
+++ sandbox/trunk/newgil/Lib/test/test_wsgiref.py Wed Nov 4 21:30:59 2009
@@ -9,7 +9,9 @@
from wsgiref.simple_server import make_server
from io import StringIO, BytesIO, BufferedReader
from socketserver import BaseServer
-import re, sys
+import os
+import re
+import sys
from test import support
@@ -444,6 +446,11 @@
class ErrorHandler(BaseCGIHandler):
"""Simple handler subclass for testing BaseHandler"""
+ # BaseHandler records the OS environment at import time, but envvars
+ # might have been changed later by other tests, which trips up
+ # HandlerTests.testEnviron().
+ os_environ = dict(os.environ.items())
+
def __init__(self,**kw):
setup_testing_defaults(kw)
BaseCGIHandler.__init__(
Modified: sandbox/trunk/newgil/Lib/test/test_xmlrpc_net.py
==============================================================================
--- sandbox/trunk/newgil/Lib/test/test_xmlrpc_net.py (original)
+++ sandbox/trunk/newgil/Lib/test/test_xmlrpc_net.py Wed Nov 4 21:30:59 2009
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+import collections
import errno
import socket
import sys
@@ -17,8 +18,7 @@
try:
t0 = server.currentTime.getCurrentTime()
except socket.error as e:
- print(" test_current_time: skipping test, got error: %s" % e,
- file=sys.stderr)
+ self.skipTest("network error: %s" % e)
return
# Perform a minimal sanity check on the result, just to be sure
@@ -35,6 +35,21 @@
# time on the server should not be too big.
self.assertTrue(delta.days <= 1)
+ def test_python_builders(self):
+ # Get the list of builders from the XMLRPC buildbot interface at
+ # python.org.
+ server = xmlrpclib.ServerProxy("http://www.python.org/dev/buildbot/all/xmlrpc/")
+ try:
+ builders = server.getAllBuilders()
+ except socket.error as e:
+ self.skipTest("network error: %s" % e)
+ return
+
+ # Perform a minimal sanity check on the result, just to be sure
+ # the request means what we think it means.
+ self.assertIsInstance(builders, collections.Sequence)
+ self.assertTrue([x for x in builders if "trunk" in x], builders)
+
def test_main():
support.requires("network")
Modified: sandbox/trunk/newgil/Misc/NEWS
==============================================================================
--- sandbox/trunk/newgil/Misc/NEWS (original)
+++ sandbox/trunk/newgil/Misc/NEWS Wed Nov 4 21:30:59 2009
@@ -12,6 +12,9 @@
Core and Builtins
-----------------
+- Issue #7244: itertools.izip_longest() no longer ignores exceptions
+ raised during the formation of an output tuple.
+
- Issue #3297: On wide unicode builds, do not split unicode characters into
surrogates.
@@ -120,6 +123,16 @@
Library
-------
+- Issue #6896: mailbox.Maildir now invalidates its internal cache each time
+ a modification is done through it. This fixes inconsistencies and test
+ failures on systems with slightly bogus mtime behaviour.
+
+- Issue #7246 & Issue #7208: getpass now properly flushes input before
+ reading from stdin so that existing input does not confuse it and
+ lead to incorrect entry or an IOError. It also properly flushes it
+ afterwards to avoid the terminal echoing the input afterwards on
+ OSes such as Solaris.
+
- Issue #7233: Fix a number of two-argument Decimal methods to make
sure that they accept an int or long as the second argument. Also
fix buggy handling of large arguments (those with coefficient longer
Modified: sandbox/trunk/newgil/Modules/itertoolsmodule.c
==============================================================================
--- sandbox/trunk/newgil/Modules/itertoolsmodule.c (original)
+++ sandbox/trunk/newgil/Modules/itertoolsmodule.c Wed Nov 4 21:30:59 2009
@@ -3344,71 +3344,73 @@
static PyObject *
zip_longest_next(ziplongestobject *lz)
{
- Py_ssize_t i;
- Py_ssize_t tuplesize = lz->tuplesize;
- PyObject *result = lz->result;
- PyObject *it;
- PyObject *item;
- PyObject *olditem;
+ Py_ssize_t i;
+ Py_ssize_t tuplesize = lz->tuplesize;
+ PyObject *result = lz->result;
+ PyObject *it;
+ PyObject *item;
+ PyObject *olditem;
- if (tuplesize == 0)
- return NULL;
+ if (tuplesize == 0)
+ return NULL;
if (lz->numactive == 0)
return NULL;
- if (Py_REFCNT(result) == 1) {
- Py_INCREF(result);
- for (i=0 ; i < tuplesize ; i++) {
- it = PyTuple_GET_ITEM(lz->ittuple, i);
+ if (Py_REFCNT(result) == 1) {
+ Py_INCREF(result);
+ for (i=0 ; i < tuplesize ; i++) {
+ it = PyTuple_GET_ITEM(lz->ittuple, i);
if (it == NULL) {
Py_INCREF(lz->fillvalue);
item = lz->fillvalue;
} else {
- item = (*Py_TYPE(it)->tp_iternext)(it);
+ item = PyIter_Next(it);
if (item == NULL) {
- lz->numactive -= 1;
- if (lz->numactive == 0) {
+ lz->numactive -= 1;
+ if (lz->numactive == 0 || PyErr_Occurred()) {
+ lz->numactive = 0;
Py_DECREF(result);
return NULL;
} else {
Py_INCREF(lz->fillvalue);
- item = lz->fillvalue;
+ item = lz->fillvalue;
PyTuple_SET_ITEM(lz->ittuple, i, NULL);
Py_DECREF(it);
}
}
}
- olditem = PyTuple_GET_ITEM(result, i);
- PyTuple_SET_ITEM(result, i, item);
- Py_DECREF(olditem);
- }
- } else {
- result = PyTuple_New(tuplesize);
- if (result == NULL)
- return NULL;
- for (i=0 ; i < tuplesize ; i++) {
- it = PyTuple_GET_ITEM(lz->ittuple, i);
+ olditem = PyTuple_GET_ITEM(result, i);
+ PyTuple_SET_ITEM(result, i, item);
+ Py_DECREF(olditem);
+ }
+ } else {
+ result = PyTuple_New(tuplesize);
+ if (result == NULL)
+ return NULL;
+ for (i=0 ; i < tuplesize ; i++) {
+ it = PyTuple_GET_ITEM(lz->ittuple, i);
if (it == NULL) {
Py_INCREF(lz->fillvalue);
item = lz->fillvalue;
} else {
- item = (*Py_TYPE(it)->tp_iternext)(it);
+ item = PyIter_Next(it);
if (item == NULL) {
- lz->numactive -= 1;
- if (lz->numactive == 0) {
+ lz->numactive -= 1;
+ if (lz->numactive == 0 || PyErr_Occurred()) {
+ lz->numactive = 0;
Py_DECREF(result);
return NULL;
} else {
Py_INCREF(lz->fillvalue);
- item = lz->fillvalue;
+ item = lz->fillvalue;
PyTuple_SET_ITEM(lz->ittuple, i, NULL);
Py_DECREF(it);
}
}
}
- PyTuple_SET_ITEM(result, i, item);
- }
- }
- return result;
+ PyTuple_SET_ITEM(result, i, item);
+ }
+ }
+ return result;
}
PyDoc_STRVAR(zip_longest_doc,
Modified: sandbox/trunk/newgil/Modules/termios.c
==============================================================================
--- sandbox/trunk/newgil/Modules/termios.c (original)
+++ sandbox/trunk/newgil/Modules/termios.c Wed Nov 4 21:30:59 2009
@@ -355,6 +355,9 @@
{"TCSANOW", TCSANOW},
{"TCSADRAIN", TCSADRAIN},
{"TCSAFLUSH", TCSAFLUSH},
+#ifdef TCSASOFT
+ {"TCSASOFT", TCSASOFT},
+#endif
/* tcflush() constants */
{"TCIFLUSH", TCIFLUSH},
Modified: sandbox/trunk/newgil/configure
==============================================================================
--- sandbox/trunk/newgil/configure (original)
+++ sandbox/trunk/newgil/configure Wed Nov 4 21:30:59 2009
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 75684 .
+# From configure.in Revision: 76030 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for python 3.2.
#
@@ -4546,50 +4546,47 @@
if test "${ac_cv_no_strict_aliasing_ok+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test "$cross_compiling" = yes; then
- ac_cv_no_strict_aliasing_ok=no
-else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
+
+int
+main ()
+{
int main() { return 0; }
+ ;
+ return 0;
+}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_no_strict_aliasing_ok=yes
else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+ echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-( exit $ac_status )
-ac_cv_no_strict_aliasing_ok=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+ ac_cv_no_strict_aliasing_ok=no
fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
CC="$ac_save_cc"
@@ -4743,50 +4740,47 @@
else
ac_save_cc="$CC"
CC="$CC -OPT:Olimit=0"
-if test "$cross_compiling" = yes; then
- ac_cv_opt_olimit_ok=no
-else
- cat >conftest.$ac_ext <<_ACEOF
+cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
+
+int
+main ()
+{
int main() { return 0; }
+ ;
+ return 0;
+}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_opt_olimit_ok=yes
else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+ echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-( exit $ac_status )
-ac_cv_opt_olimit_ok=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+ ac_cv_opt_olimit_ok=no
fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CC="$ac_save_cc"
fi
@@ -4811,50 +4805,47 @@
else
ac_save_cc="$CC"
CC="$CC -Olimit 1500"
- if test "$cross_compiling" = yes; then
- ac_cv_olimit_ok=no
-else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
+
+int
+main ()
+{
int main() { return 0; }
+ ;
+ return 0;
+}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_olimit_ok=yes
else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+ echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-( exit $ac_status )
-ac_cv_olimit_ok=no
+ ac_cv_olimit_ok=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CC="$ac_save_cc"
fi
Modified: sandbox/trunk/newgil/configure.in
==============================================================================
--- sandbox/trunk/newgil/configure.in (original)
+++ sandbox/trunk/newgil/configure.in Wed Nov 4 21:30:59 2009
@@ -856,9 +856,8 @@
ac_save_cc="$CC"
CC="$CC -fno-strict-aliasing"
AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
- AC_TRY_RUN([int main() { return 0; }],
+ AC_TRY_COMPILE([],[int main() { return 0; }],
ac_cv_no_strict_aliasing_ok=yes,
- ac_cv_no_strict_aliasing_ok=no,
ac_cv_no_strict_aliasing_ok=no))
CC="$ac_save_cc"
AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
@@ -1005,10 +1004,10 @@
AC_CACHE_VAL(ac_cv_opt_olimit_ok,
[ac_save_cc="$CC"
CC="$CC -OPT:Olimit=0"
-AC_TRY_RUN([int main() { return 0; }],
+AC_TRY_COMPILE([],[int main() { return 0; }],
ac_cv_opt_olimit_ok=yes,
ac_cv_opt_olimit_ok=no,
- ac_cv_opt_olimit_ok=no)
+ )
CC="$ac_save_cc"])
AC_MSG_RESULT($ac_cv_opt_olimit_ok)
if test $ac_cv_opt_olimit_ok = yes; then
@@ -1027,10 +1026,10 @@
AC_CACHE_VAL(ac_cv_olimit_ok,
[ac_save_cc="$CC"
CC="$CC -Olimit 1500"
- AC_TRY_RUN([int main() { return 0; }],
+ AC_TRY_COMPILE([],[int main() { return 0; }],
ac_cv_olimit_ok=yes,
ac_cv_olimit_ok=no,
- ac_cv_olimit_ok=no)
+ )
CC="$ac_save_cc"])
AC_MSG_RESULT($ac_cv_olimit_ok)
if test $ac_cv_olimit_ok = yes; then
More information about the Python-checkins
mailing list