benjamin.peterson
2008-10-25 15:49:18 UTC
Author: benjamin.peterson
Date: Sat Oct 25 17:49:17 2008
New Revision: 67018
Log:
Merged revisions 66974,66977,66984,66989,66992,66994-66996,66998-67000,67007,67015 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk
........
r66974 | benjamin.peterson | 2008-10-19 08:59:01 -0500 (Sun, 19 Oct 2008) | 1 line
fix compiler warning
........
r66977 | benjamin.peterson | 2008-10-19 14:39:16 -0500 (Sun, 19 Oct 2008) | 1 line
mention -n
........
r66984 | armin.ronacher | 2008-10-20 16:29:08 -0500 (Mon, 20 Oct 2008) | 3 lines
Fixed #4062, added import for _ast.__version__ to ast to match the documented behavior.
........
r66989 | matthias.klose | 2008-10-21 04:12:25 -0500 (Tue, 21 Oct 2008) | 2 lines
- install versioned manpage
........
r66992 | benjamin.peterson | 2008-10-21 15:51:13 -0500 (Tue, 21 Oct 2008) | 1 line
make sure to call iteritems()
........
r66994 | amaury.forgeotdarc | 2008-10-21 17:01:38 -0500 (Tue, 21 Oct 2008) | 6 lines
#4157 move two test functions out of platform.py.
Turn them into unit tests, and correct an obvious typo:
(("a", "b") ("c", "d") ("e", "f"))
compiles even with the missing commas, but does not execute very well...
........
r66995 | benjamin.peterson | 2008-10-21 17:18:29 -0500 (Tue, 21 Oct 2008) | 1 line
return ArgInfo from inspect.getargvalues #4092
........
r66996 | benjamin.peterson | 2008-10-21 17:20:31 -0500 (Tue, 21 Oct 2008) | 1 line
add NEWs note for last change
........
r66998 | benjamin.peterson | 2008-10-22 15:57:43 -0500 (Wed, 22 Oct 2008) | 1 line
fix a few typos
........
r66999 | benjamin.peterson | 2008-10-22 16:05:30 -0500 (Wed, 22 Oct 2008) | 1 line
and another typo...
........
r67000 | benjamin.peterson | 2008-10-22 16:16:34 -0500 (Wed, 22 Oct 2008) | 1 line
fix #4150: pdb's up command didn't work for generators in post-mortem
........
r67007 | benjamin.peterson | 2008-10-23 16:43:48 -0500 (Thu, 23 Oct 2008) | 1 line
only nonempty __slots__ don't work
........
r67015 | georg.brandl | 2008-10-25 02:00:52 -0500 (Sat, 25 Oct 2008) | 2 lines
Typo fix.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Doc/library/2to3.rst
python/branches/py3k/Doc/reference/datamodel.rst
python/branches/py3k/Lib/ast.py
python/branches/py3k/Lib/bdb.py
python/branches/py3k/Lib/inspect.py
python/branches/py3k/Lib/pdb.py
python/branches/py3k/Lib/platform.py
python/branches/py3k/Lib/test/test_platform.py
python/branches/py3k/Lib/test/test_urllib.py
python/branches/py3k/Makefile.pre.in
python/branches/py3k/Parser/asdl_c.py
python/branches/py3k/Python/Python-ast.c
Modified: python/branches/py3k/Doc/library/2to3.rst
==============================================================================
--- python/branches/py3k/Doc/library/2to3.rst (original)
+++ python/branches/py3k/Doc/library/2to3.rst Sat Oct 25 17:49:17 2008
@@ -37,8 +37,8 @@
A diff against the original source file is printed. 2to3 can also write the
needed modifications right back to the source file. (Of course, a backup of the
-original is also be made.) Writing the changes back is enabled with the
-:option:`-w` flag::
+original is also be made unless :option:`-n` is also given.) Writing the
+changes back is enabled with the :option:`-w` flag::
$ 2to3 -w example.py
@@ -50,11 +50,10 @@
name = input()
greet(name)
-Comments and and exact indentation are preserved throughout the translation
-process.
+Comments and exact indentation are preserved throughout the translation process.
By default, 2to3 runs a set of predefined fixers. The :option:`-l` flag lists
-all avaible fixers. An explicit set of fixers to run can be given with
+all available fixers. An explicit set of fixers to run can be given with
:option:`-f`. Likewise the :option:`-x` explicitly disables a fixer. The
following example runs only the ``imports`` and ``has_key`` fixers::
@@ -64,7 +63,7 @@
$ 2to3 -x apply example.py
-Some fixers are *explicit*, meaning they aren't run be default and must be
+Some fixers are *explicit*, meaning they aren't run by default and must be
listed on the command line to be run. Here, in addition to the default fixers,
the ``idioms`` fixer is run::
@@ -72,10 +71,10 @@
Notice how passing ``all`` enables all default fixers.
-Sometimes 2to3 will find will find a place in your source code that needs to be
-changed, but 2to3 cannot fix automatically. In this case, 2to3 will print a
-warning beneath the diff for a file. You should address the warning in order to
-have compliant 3.x code.
+Sometimes 2to3 will find a place in your source code that needs to be changed,
+but 2to3 cannot fix automatically. In this case, 2to3 will print a warning
+beneath the diff for a file. You should address the warning in order to have
+compliant 3.x code.
2to3 can also refactor doctests. To enable this mode, use the :option:`-d`
flag. Note that *only* doctests will be refactored. This also doesn't require
@@ -89,7 +88,7 @@
a statement. This is useful when ``from __future__ import print_function`` is
being used. If this option is not given, the print fixer will surround print
calls in an extra set of parentheses because it cannot differentiate between the
-and print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a
+print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a
true function call.
Modified: python/branches/py3k/Doc/reference/datamodel.rst
==============================================================================
--- python/branches/py3k/Doc/reference/datamodel.rst (original)
+++ python/branches/py3k/Doc/reference/datamodel.rst Sat Oct 25 17:49:17 2008
@@ -1465,8 +1465,8 @@
defined. As a result, subclasses will have a *__dict__* unless they also define
*__slots__*.
-* *__slots__* do not work for classes derived from "variable-length" built-in
- types such as :class:`int`, :class:`str` and :class:`tuple`.
+* Nonempty *__slots__* does not work for classes derived from "variable-length"
+ built-in types such as :class:`int`, :class:`str` and :class:`tuple`.
* Any non-string iterable may be assigned to *__slots__*. Mappings may also be
used; however, in the future, special meaning may be assigned to the values
Modified: python/branches/py3k/Lib/ast.py
==============================================================================
--- python/branches/py3k/Lib/ast.py (original)
+++ python/branches/py3k/Lib/ast.py Sat Oct 25 17:49:17 2008
@@ -26,6 +26,7 @@
:license: Python License.
"""
from _ast import *
+from _ast import __version__
def parse(expr, filename='<unknown>', mode='exec'):
Modified: python/branches/py3k/Lib/bdb.py
==============================================================================
--- python/branches/py3k/Lib/bdb.py (original)
+++ python/branches/py3k/Lib/bdb.py Sat Oct 25 17:49:17 2008
@@ -319,6 +319,8 @@
while t is not None:
stack.append((t.tb_frame, t.tb_lineno))
t = t.tb_next
+ if f is None:
+ i = max(0, len(stack) - 1)
return stack, i
#
Modified: python/branches/py3k/Lib/inspect.py
==============================================================================
--- python/branches/py3k/Lib/inspect.py (original)
+++ python/branches/py3k/Lib/inspect.py Sat Oct 25 17:49:17 2008
@@ -826,7 +826,7 @@
'varargs' and 'varkw' are the names of the * and ** arguments or None.
'locals' is the locals dictionary of the given frame."""
args, varargs, varkw = getargs(frame.f_code)
- return args, varargs, varkw, frame.f_locals
+ return ArgInfo(args, varargs, varkw, frame.f_locals)
def joinseq(seq):
if len(seq) == 1:
Modified: python/branches/py3k/Lib/pdb.py
==============================================================================
--- python/branches/py3k/Lib/pdb.py (original)
+++ python/branches/py3k/Lib/pdb.py Sat Oct 25 17:49:17 2008
@@ -1220,9 +1220,7 @@
p = Pdb()
p.reset()
- while t.tb_next is not None:
- t = t.tb_next
- p.interaction(t.tb_frame, t)
+ p.interaction(None, t)
def pm():
post_mortem(sys.last_traceback)
@@ -1285,9 +1283,7 @@
print("Uncaught exception. Entering post mortem debugging")
print("Running 'cont' or 'step' will restart the program")
t = sys.exc_info()[2]
- while t.tb_next is not None:
- t = t.tb_next
- pdb.interaction(t.tb_frame,t)
+ pdb.interaction(None, t)
print("Post mortem debugger finished. The "+mainpyfile+" will be restarted")
Modified: python/branches/py3k/Lib/platform.py
==============================================================================
--- python/branches/py3k/Lib/platform.py (original)
+++ python/branches/py3k/Lib/platform.py Sat Oct 25 17:49:17 2008
@@ -266,24 +266,6 @@
id = ''
return '', version, id
-def _test_parse_release_file():
-
- for input, output in (
- # Examples of release file contents:
- ('SuSE Linux 9.3 (x86-64)', ('SuSE Linux ', '9.3', 'x86-64'))
- ('SUSE LINUX 10.1 (X86-64)', ('SUSE LINUX ', '10.1', 'X86-64'))
- ('SUSE LINUX 10.1 (i586)', ('SUSE LINUX ', '10.1', 'i586'))
- ('Fedora Core release 5 (Bordeaux)', ('Fedora Core', '5', 'Bordeaux'))
- ('Red Hat Linux release 8.0 (Psyche)', ('Red Hat Linux', '8.0', 'Psyche'))
- ('Red Hat Linux release 9 (Shrike)', ('Red Hat Linux', '9', 'Shrike'))
- ('Red Hat Enterprise Linux release 4 (Nahant)', ('Red Hat Enterprise Linux', '4', 'Nahant'))
- ('CentOS release 4', ('CentOS', '4', None))
- ('Rocks release 4.2.1 (Cydonia)', ('Rocks', '4.2.1', 'Cydonia'))
- ):
- parsed = _parse_release_file(input)
- if parsed != output:
- print((input, parsed))
-
def linux_distribution(distname='', version='', id='',
supported_dists=_supported_dists,
@@ -1357,21 +1339,6 @@
_sys_version_cache[sys_version] = result
return result
-def _test_sys_version():
-
- _sys_version_cache.clear()
- for input, output in (
- ('2.4.3 (#1, Jun 21 2006, 13:54:21) \n[GCC 3.3.4 (pre 3.3.5 20040809)]',
- ('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')),
- ('IronPython 1.0.60816 on .NET 2.0.50727.42',
- ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')),
- ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42',
- ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')),
- ):
- parsed = _sys_version(input)
- if parsed != output:
- print((input, parsed))
-
def python_implementation():
""" Returns a string identifying the Python implementation.
Modified: python/branches/py3k/Lib/test/test_platform.py
==============================================================================
--- python/branches/py3k/Lib/test/test_platform.py (original)
+++ python/branches/py3k/Lib/test/test_platform.py Sat Oct 25 17:49:17 2008
@@ -115,6 +115,40 @@
executable = executable + '.exe'
res = platform.libc_ver(sys.executable)
+ def test_parse_release_file(self):
+
+ for input, output in (
+ # Examples of release file contents:
+ ('SuSE Linux 9.3 (x86-64)', ('SuSE Linux ', '9.3', 'x86-64')),
+ ('SUSE LINUX 10.1 (X86-64)', ('SUSE LINUX ', '10.1', 'X86-64')),
+ ('SUSE LINUX 10.1 (i586)', ('SUSE LINUX ', '10.1', 'i586')),
+ ('Fedora Core release 5 (Bordeaux)', ('Fedora Core', '5', 'Bordeaux')),
+ ('Red Hat Linux release 8.0 (Psyche)', ('Red Hat Linux', '8.0', 'Psyche')),
+ ('Red Hat Linux release 9 (Shrike)', ('Red Hat Linux', '9', 'Shrike')),
+ ('Red Hat Enterprise Linux release 4 (Nahant)', ('Red Hat Enterprise Linux', '4', 'Nahant')),
+ ('CentOS release 4', ('CentOS', '4', None)),
+ ('Rocks release 4.2.1 (Cydonia)', ('Rocks', '4.2.1', 'Cydonia')),
+ ):
+ self.assertEqual(platform._parse_release_file(input), output)
+
+ def test_sys_version(self):
+
+ platform._sys_version_cache.clear()
+ for input, output in (
+ ('2.4.3 (#1, Jun 21 2006, 13:54:21) \n[GCC 3.3.4 (pre 3.3.5 20040809)]',
+ ('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')),
+ ('IronPython 1.0.60816 on .NET 2.0.50727.42',
+ ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')),
+ ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42',
+ ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')),
+ ):
+ # branch and revision are not "parsed", but fetched
+ # from sys.subversion. Ignore them
+ (name, version, branch, revision, buildno, builddate, compiler) \
+ = platform._sys_version(input)
+ self.assertEqual(
+ (name, version, '', '', buildno, builddate, compiler), output)
+
def test_main():
support.run_unittest(
PlatformTest
Modified: python/branches/py3k/Lib/test/test_urllib.py
==============================================================================
--- python/branches/py3k/Lib/test/test_urllib.py (original)
+++ python/branches/py3k/Lib/test/test_urllib.py Sat Oct 25 17:49:17 2008
@@ -117,7 +117,6 @@
class ProxyTests(unittest.TestCase):
def setUp(self):
- unittest.TestCase.setUp(self)
# Save all proxy related env vars
self._saved_environ = dict([(k, v) for k, v in os.environ.items()
if k.lower().find('proxy') >= 0])
@@ -126,9 +125,8 @@
del os.environ[k]
def tearDown(self):
- unittest.TestCase.tearDown(self)
# Restore all proxy related env vars
- for k, v in self._saved_environ:
+ for k, v in self._saved_environ.items():
os.environ[k] = v
def test_getproxies_environment_keep_no_proxies(self):
Modified: python/branches/py3k/Makefile.pre.in
==============================================================================
--- python/branches/py3k/Makefile.pre.in (original)
+++ python/branches/py3k/Makefile.pre.in Sat Oct 25 17:49:17 2008
@@ -796,7 +796,7 @@
fi; \
done
$(INSTALL_DATA) $(srcdir)/Misc/python.man \
- $(DESTDIR)$(MANDIR)/man1/python.1
+ $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
# Install the library
PLATDIR= plat-$(MACHDEP)
Modified: python/branches/py3k/Parser/asdl_c.py
==============================================================================
--- python/branches/py3k/Parser/asdl_c.py (original)
+++ python/branches/py3k/Parser/asdl_c.py Sat Oct 25 17:49:17 2008
@@ -804,7 +804,7 @@
return 0;
}
-static int add_ast_fields()
+static int add_ast_fields(void)
{
PyObject *empty_tuple, *d;
if (PyType_Ready(&AST_type) < 0)
Modified: python/branches/py3k/Python/Python-ast.c
==============================================================================
--- python/branches/py3k/Python/Python-ast.c (original)
+++ python/branches/py3k/Python/Python-ast.c Sat Oct 25 17:49:17 2008
@@ -621,7 +621,7 @@
return 0;
}
-static int add_ast_fields()
+static int add_ast_fields(void)
{
PyObject *empty_tuple, *d;
if (PyType_Ready(&AST_type) < 0)
Date: Sat Oct 25 17:49:17 2008
New Revision: 67018
Log:
Merged revisions 66974,66977,66984,66989,66992,66994-66996,66998-67000,67007,67015 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk
........
r66974 | benjamin.peterson | 2008-10-19 08:59:01 -0500 (Sun, 19 Oct 2008) | 1 line
fix compiler warning
........
r66977 | benjamin.peterson | 2008-10-19 14:39:16 -0500 (Sun, 19 Oct 2008) | 1 line
mention -n
........
r66984 | armin.ronacher | 2008-10-20 16:29:08 -0500 (Mon, 20 Oct 2008) | 3 lines
Fixed #4062, added import for _ast.__version__ to ast to match the documented behavior.
........
r66989 | matthias.klose | 2008-10-21 04:12:25 -0500 (Tue, 21 Oct 2008) | 2 lines
- install versioned manpage
........
r66992 | benjamin.peterson | 2008-10-21 15:51:13 -0500 (Tue, 21 Oct 2008) | 1 line
make sure to call iteritems()
........
r66994 | amaury.forgeotdarc | 2008-10-21 17:01:38 -0500 (Tue, 21 Oct 2008) | 6 lines
#4157 move two test functions out of platform.py.
Turn them into unit tests, and correct an obvious typo:
(("a", "b") ("c", "d") ("e", "f"))
compiles even with the missing commas, but does not execute very well...
........
r66995 | benjamin.peterson | 2008-10-21 17:18:29 -0500 (Tue, 21 Oct 2008) | 1 line
return ArgInfo from inspect.getargvalues #4092
........
r66996 | benjamin.peterson | 2008-10-21 17:20:31 -0500 (Tue, 21 Oct 2008) | 1 line
add NEWs note for last change
........
r66998 | benjamin.peterson | 2008-10-22 15:57:43 -0500 (Wed, 22 Oct 2008) | 1 line
fix a few typos
........
r66999 | benjamin.peterson | 2008-10-22 16:05:30 -0500 (Wed, 22 Oct 2008) | 1 line
and another typo...
........
r67000 | benjamin.peterson | 2008-10-22 16:16:34 -0500 (Wed, 22 Oct 2008) | 1 line
fix #4150: pdb's up command didn't work for generators in post-mortem
........
r67007 | benjamin.peterson | 2008-10-23 16:43:48 -0500 (Thu, 23 Oct 2008) | 1 line
only nonempty __slots__ don't work
........
r67015 | georg.brandl | 2008-10-25 02:00:52 -0500 (Sat, 25 Oct 2008) | 2 lines
Typo fix.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Doc/library/2to3.rst
python/branches/py3k/Doc/reference/datamodel.rst
python/branches/py3k/Lib/ast.py
python/branches/py3k/Lib/bdb.py
python/branches/py3k/Lib/inspect.py
python/branches/py3k/Lib/pdb.py
python/branches/py3k/Lib/platform.py
python/branches/py3k/Lib/test/test_platform.py
python/branches/py3k/Lib/test/test_urllib.py
python/branches/py3k/Makefile.pre.in
python/branches/py3k/Parser/asdl_c.py
python/branches/py3k/Python/Python-ast.c
Modified: python/branches/py3k/Doc/library/2to3.rst
==============================================================================
--- python/branches/py3k/Doc/library/2to3.rst (original)
+++ python/branches/py3k/Doc/library/2to3.rst Sat Oct 25 17:49:17 2008
@@ -37,8 +37,8 @@
A diff against the original source file is printed. 2to3 can also write the
needed modifications right back to the source file. (Of course, a backup of the
-original is also be made.) Writing the changes back is enabled with the
-:option:`-w` flag::
+original is also be made unless :option:`-n` is also given.) Writing the
+changes back is enabled with the :option:`-w` flag::
$ 2to3 -w example.py
@@ -50,11 +50,10 @@
name = input()
greet(name)
-Comments and and exact indentation are preserved throughout the translation
-process.
+Comments and exact indentation are preserved throughout the translation process.
By default, 2to3 runs a set of predefined fixers. The :option:`-l` flag lists
-all avaible fixers. An explicit set of fixers to run can be given with
+all available fixers. An explicit set of fixers to run can be given with
:option:`-f`. Likewise the :option:`-x` explicitly disables a fixer. The
following example runs only the ``imports`` and ``has_key`` fixers::
@@ -64,7 +63,7 @@
$ 2to3 -x apply example.py
-Some fixers are *explicit*, meaning they aren't run be default and must be
+Some fixers are *explicit*, meaning they aren't run by default and must be
listed on the command line to be run. Here, in addition to the default fixers,
the ``idioms`` fixer is run::
@@ -72,10 +71,10 @@
Notice how passing ``all`` enables all default fixers.
-Sometimes 2to3 will find will find a place in your source code that needs to be
-changed, but 2to3 cannot fix automatically. In this case, 2to3 will print a
-warning beneath the diff for a file. You should address the warning in order to
-have compliant 3.x code.
+Sometimes 2to3 will find a place in your source code that needs to be changed,
+but 2to3 cannot fix automatically. In this case, 2to3 will print a warning
+beneath the diff for a file. You should address the warning in order to have
+compliant 3.x code.
2to3 can also refactor doctests. To enable this mode, use the :option:`-d`
flag. Note that *only* doctests will be refactored. This also doesn't require
@@ -89,7 +88,7 @@
a statement. This is useful when ``from __future__ import print_function`` is
being used. If this option is not given, the print fixer will surround print
calls in an extra set of parentheses because it cannot differentiate between the
-and print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a
+print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a
true function call.
Modified: python/branches/py3k/Doc/reference/datamodel.rst
==============================================================================
--- python/branches/py3k/Doc/reference/datamodel.rst (original)
+++ python/branches/py3k/Doc/reference/datamodel.rst Sat Oct 25 17:49:17 2008
@@ -1465,8 +1465,8 @@
defined. As a result, subclasses will have a *__dict__* unless they also define
*__slots__*.
-* *__slots__* do not work for classes derived from "variable-length" built-in
- types such as :class:`int`, :class:`str` and :class:`tuple`.
+* Nonempty *__slots__* does not work for classes derived from "variable-length"
+ built-in types such as :class:`int`, :class:`str` and :class:`tuple`.
* Any non-string iterable may be assigned to *__slots__*. Mappings may also be
used; however, in the future, special meaning may be assigned to the values
Modified: python/branches/py3k/Lib/ast.py
==============================================================================
--- python/branches/py3k/Lib/ast.py (original)
+++ python/branches/py3k/Lib/ast.py Sat Oct 25 17:49:17 2008
@@ -26,6 +26,7 @@
:license: Python License.
"""
from _ast import *
+from _ast import __version__
def parse(expr, filename='<unknown>', mode='exec'):
Modified: python/branches/py3k/Lib/bdb.py
==============================================================================
--- python/branches/py3k/Lib/bdb.py (original)
+++ python/branches/py3k/Lib/bdb.py Sat Oct 25 17:49:17 2008
@@ -319,6 +319,8 @@
while t is not None:
stack.append((t.tb_frame, t.tb_lineno))
t = t.tb_next
+ if f is None:
+ i = max(0, len(stack) - 1)
return stack, i
#
Modified: python/branches/py3k/Lib/inspect.py
==============================================================================
--- python/branches/py3k/Lib/inspect.py (original)
+++ python/branches/py3k/Lib/inspect.py Sat Oct 25 17:49:17 2008
@@ -826,7 +826,7 @@
'varargs' and 'varkw' are the names of the * and ** arguments or None.
'locals' is the locals dictionary of the given frame."""
args, varargs, varkw = getargs(frame.f_code)
- return args, varargs, varkw, frame.f_locals
+ return ArgInfo(args, varargs, varkw, frame.f_locals)
def joinseq(seq):
if len(seq) == 1:
Modified: python/branches/py3k/Lib/pdb.py
==============================================================================
--- python/branches/py3k/Lib/pdb.py (original)
+++ python/branches/py3k/Lib/pdb.py Sat Oct 25 17:49:17 2008
@@ -1220,9 +1220,7 @@
p = Pdb()
p.reset()
- while t.tb_next is not None:
- t = t.tb_next
- p.interaction(t.tb_frame, t)
+ p.interaction(None, t)
def pm():
post_mortem(sys.last_traceback)
@@ -1285,9 +1283,7 @@
print("Uncaught exception. Entering post mortem debugging")
print("Running 'cont' or 'step' will restart the program")
t = sys.exc_info()[2]
- while t.tb_next is not None:
- t = t.tb_next
- pdb.interaction(t.tb_frame,t)
+ pdb.interaction(None, t)
print("Post mortem debugger finished. The "+mainpyfile+" will be restarted")
Modified: python/branches/py3k/Lib/platform.py
==============================================================================
--- python/branches/py3k/Lib/platform.py (original)
+++ python/branches/py3k/Lib/platform.py Sat Oct 25 17:49:17 2008
@@ -266,24 +266,6 @@
id = ''
return '', version, id
-def _test_parse_release_file():
-
- for input, output in (
- # Examples of release file contents:
- ('SuSE Linux 9.3 (x86-64)', ('SuSE Linux ', '9.3', 'x86-64'))
- ('SUSE LINUX 10.1 (X86-64)', ('SUSE LINUX ', '10.1', 'X86-64'))
- ('SUSE LINUX 10.1 (i586)', ('SUSE LINUX ', '10.1', 'i586'))
- ('Fedora Core release 5 (Bordeaux)', ('Fedora Core', '5', 'Bordeaux'))
- ('Red Hat Linux release 8.0 (Psyche)', ('Red Hat Linux', '8.0', 'Psyche'))
- ('Red Hat Linux release 9 (Shrike)', ('Red Hat Linux', '9', 'Shrike'))
- ('Red Hat Enterprise Linux release 4 (Nahant)', ('Red Hat Enterprise Linux', '4', 'Nahant'))
- ('CentOS release 4', ('CentOS', '4', None))
- ('Rocks release 4.2.1 (Cydonia)', ('Rocks', '4.2.1', 'Cydonia'))
- ):
- parsed = _parse_release_file(input)
- if parsed != output:
- print((input, parsed))
-
def linux_distribution(distname='', version='', id='',
supported_dists=_supported_dists,
@@ -1357,21 +1339,6 @@
_sys_version_cache[sys_version] = result
return result
-def _test_sys_version():
-
- _sys_version_cache.clear()
- for input, output in (
- ('2.4.3 (#1, Jun 21 2006, 13:54:21) \n[GCC 3.3.4 (pre 3.3.5 20040809)]',
- ('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')),
- ('IronPython 1.0.60816 on .NET 2.0.50727.42',
- ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')),
- ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42',
- ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')),
- ):
- parsed = _sys_version(input)
- if parsed != output:
- print((input, parsed))
-
def python_implementation():
""" Returns a string identifying the Python implementation.
Modified: python/branches/py3k/Lib/test/test_platform.py
==============================================================================
--- python/branches/py3k/Lib/test/test_platform.py (original)
+++ python/branches/py3k/Lib/test/test_platform.py Sat Oct 25 17:49:17 2008
@@ -115,6 +115,40 @@
executable = executable + '.exe'
res = platform.libc_ver(sys.executable)
+ def test_parse_release_file(self):
+
+ for input, output in (
+ # Examples of release file contents:
+ ('SuSE Linux 9.3 (x86-64)', ('SuSE Linux ', '9.3', 'x86-64')),
+ ('SUSE LINUX 10.1 (X86-64)', ('SUSE LINUX ', '10.1', 'X86-64')),
+ ('SUSE LINUX 10.1 (i586)', ('SUSE LINUX ', '10.1', 'i586')),
+ ('Fedora Core release 5 (Bordeaux)', ('Fedora Core', '5', 'Bordeaux')),
+ ('Red Hat Linux release 8.0 (Psyche)', ('Red Hat Linux', '8.0', 'Psyche')),
+ ('Red Hat Linux release 9 (Shrike)', ('Red Hat Linux', '9', 'Shrike')),
+ ('Red Hat Enterprise Linux release 4 (Nahant)', ('Red Hat Enterprise Linux', '4', 'Nahant')),
+ ('CentOS release 4', ('CentOS', '4', None)),
+ ('Rocks release 4.2.1 (Cydonia)', ('Rocks', '4.2.1', 'Cydonia')),
+ ):
+ self.assertEqual(platform._parse_release_file(input), output)
+
+ def test_sys_version(self):
+
+ platform._sys_version_cache.clear()
+ for input, output in (
+ ('2.4.3 (#1, Jun 21 2006, 13:54:21) \n[GCC 3.3.4 (pre 3.3.5 20040809)]',
+ ('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')),
+ ('IronPython 1.0.60816 on .NET 2.0.50727.42',
+ ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')),
+ ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42',
+ ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')),
+ ):
+ # branch and revision are not "parsed", but fetched
+ # from sys.subversion. Ignore them
+ (name, version, branch, revision, buildno, builddate, compiler) \
+ = platform._sys_version(input)
+ self.assertEqual(
+ (name, version, '', '', buildno, builddate, compiler), output)
+
def test_main():
support.run_unittest(
PlatformTest
Modified: python/branches/py3k/Lib/test/test_urllib.py
==============================================================================
--- python/branches/py3k/Lib/test/test_urllib.py (original)
+++ python/branches/py3k/Lib/test/test_urllib.py Sat Oct 25 17:49:17 2008
@@ -117,7 +117,6 @@
class ProxyTests(unittest.TestCase):
def setUp(self):
- unittest.TestCase.setUp(self)
# Save all proxy related env vars
self._saved_environ = dict([(k, v) for k, v in os.environ.items()
if k.lower().find('proxy') >= 0])
@@ -126,9 +125,8 @@
del os.environ[k]
def tearDown(self):
- unittest.TestCase.tearDown(self)
# Restore all proxy related env vars
- for k, v in self._saved_environ:
+ for k, v in self._saved_environ.items():
os.environ[k] = v
def test_getproxies_environment_keep_no_proxies(self):
Modified: python/branches/py3k/Makefile.pre.in
==============================================================================
--- python/branches/py3k/Makefile.pre.in (original)
+++ python/branches/py3k/Makefile.pre.in Sat Oct 25 17:49:17 2008
@@ -796,7 +796,7 @@
fi; \
done
$(INSTALL_DATA) $(srcdir)/Misc/python.man \
- $(DESTDIR)$(MANDIR)/man1/python.1
+ $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1
# Install the library
PLATDIR= plat-$(MACHDEP)
Modified: python/branches/py3k/Parser/asdl_c.py
==============================================================================
--- python/branches/py3k/Parser/asdl_c.py (original)
+++ python/branches/py3k/Parser/asdl_c.py Sat Oct 25 17:49:17 2008
@@ -804,7 +804,7 @@
return 0;
}
-static int add_ast_fields()
+static int add_ast_fields(void)
{
PyObject *empty_tuple, *d;
if (PyType_Ready(&AST_type) < 0)
Modified: python/branches/py3k/Python/Python-ast.c
==============================================================================
--- python/branches/py3k/Python/Python-ast.c (original)
+++ python/branches/py3k/Python/Python-ast.c Sat Oct 25 17:49:17 2008
@@ -621,7 +621,7 @@
return 0;
}
-static int add_ast_fields()
+static int add_ast_fields(void)
{
PyObject *empty_tuple, *d;
if (PyType_Ready(&AST_type) < 0)