Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 611f8f5

Browse files
committed
Merged revisions 83352,83355-83358,83362,83366,83368-83369 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ........ r83352 | georg.brandl | 2010-07-31 20:11:07 +0200 (Sa, 31 Jul 2010) | 1 line #9440: Remove borderline test case that fails based on unpredictable conditions such as compiler flags. ........ r83355 | georg.brandl | 2010-07-31 21:17:11 +0200 (Sa, 31 Jul 2010) | 1 line Fix bad merge: test_support -> support. ........ r83356 | georg.brandl | 2010-07-31 21:29:15 +0200 (Sa, 31 Jul 2010) | 1 line Remove trailing whitespace. ........ r83357 | georg.brandl | 2010-07-31 21:59:55 +0200 (Sa, 31 Jul 2010) | 1 line #5778: document that sys.version can contain a newline. ........ r83358 | georg.brandl | 2010-07-31 22:05:31 +0200 (Sa, 31 Jul 2010) | 1 line #9442: do not document a specific format for sys.version; rather refer to version_info and the platform module. ........ r83362 | georg.brandl | 2010-07-31 23:12:15 +0200 (Sa, 31 Jul 2010) | 1 line #8910: add a file explaining why Lib/test/data is there. ........ r83366 | georg.brandl | 2010-07-31 23:26:40 +0200 (Sa, 31 Jul 2010) | 1 line There always is a False and True now. ........ r83368 | georg.brandl | 2010-07-31 23:40:15 +0200 (Sa, 31 Jul 2010) | 1 line #7909: the prefixes \\.\ and \\?\ indicate special Windows paths, do not try to manipulate them. See http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx for details. ........ r83369 | georg.brandl | 2010-07-31 23:41:42 +0200 (Sa, 31 Jul 2010) | 1 line Fix "Berkeley" name. ........
1 parent e5d518f commit 611f8f5

8 files changed

Lines changed: 33 additions & 20 deletions

File tree

Doc/library/dbm.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
:synopsis: Interfaces to various Unix "database" formats.
66

77
:mod:`dbm` is a generic interface to variants of the DBM database ---
8-
:mod:`dbm.gnu` or :mod:`dbm.ndbm`. If none of these modules is installed, the
9-
slow-but-simple implementation in module :mod:`dbm.dumb` will be used. There
10-
is a `third party interface <http://www.jcea.es/programacion/pybsddb.htm>`_ to
11-
the Oracle Berkely DB.
8+
:mod:`dbm.gnu` or :mod:`dbm.ndbm`. If none of these modules is installed, the
9+
slow-but-simple implementation in module :mod:`dbm.dumb` will be used. There
10+
is a `third party interface <http://www.jcea.es/programacion/pybsddb.htm>`_ to
11+
the Oracle Berkeley DB.
1212

1313

1414
.. exception:: error

Doc/library/sys.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -853,14 +853,10 @@ always available.
853853
.. data:: version
854854

855855
A string containing the version number of the Python interpreter plus additional
856-
information on the build number and compiler used. It has a value of the form
857-
``'version (#build_number, build_date, build_time) [compiler]'``. The first
858-
three characters are used to identify the version in the installation
859-
directories (where appropriate on each platform). An example::
860-
861-
>>> import sys
862-
>>> sys.version
863-
'1.5.2 (#0 Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)]'
856+
information on the build number and compiler used. This string is displayed
857+
when the interactive interpreter is started. Do not extract version information
858+
out of it, rather, use :data:`version_info` and the functions provided by the
859+
:mod:`platform` module.
864860

865861

866862
.. data:: api_version

Lib/ntpath.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ def _get_colon(path):
7070
else:
7171
return ':'
7272

73+
def _get_special(path):
74+
if isinstance(path, bytes):
75+
return (b'\\\\.\\', b'\\\\?\\')
76+
else:
77+
return ('\\\\.\\', '\\\\?\\')
78+
7379
# Normalize the case of a pathname and map slashes to backslashes.
7480
# Other normalizations (such as optimizing '../' away) are not done
7581
# (this is done by normpath).
@@ -508,6 +514,13 @@ def normpath(path):
508514
"""Normalize path, eliminating double slashes, etc."""
509515
sep = _get_sep(path)
510516
dotdot = _get_dot(path) * 2
517+
special_prefixes = _get_special(path)
518+
if path.startswith(special_prefixes):
519+
# in the case of paths with these prefixes:
520+
# \\.\ -> device names
521+
# \\?\ -> literal paths
522+
# do not do any normalization, but return the path unchanged
523+
return path
511524
path = path.replace(_get_altsep(path), sep)
512525
prefix, path = splitdrive(path)
513526

Lib/test/test_ntpath.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ def test_normpath(self):
174174
tester("ntpath.normpath('C:////a/b')", r'C:\a\b')
175175
tester("ntpath.normpath('//machine/share//a/b')", r'\\machine\share\a\b')
176176

177+
tester("ntpath.normpath('\\\\.\\NUL')", r'\\.\NUL')
178+
tester("ntpath.normpath('\\\\?\\D:/XY\\Z')", r'\\?\D:/XY\Z')
179+
177180
def test_expandvars(self):
178181
with support.EnvironmentVarGuard() as env:
179182
env.clear()

Lib/test/test_optparse.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,15 +783,13 @@ def test_bool_false(self):
783783
(options, args) = self.assertParseOK(["-q"],
784784
{'verbose': 0},
785785
[])
786-
if hasattr(__builtins__, 'False'):
787-
self.assertTrue(options.verbose is False)
786+
self.assertTrue(options.verbose is False)
788787

789788
def test_bool_true(self):
790789
(options, args) = self.assertParseOK(["-v"],
791790
{'verbose': 1},
792791
[])
793-
if hasattr(__builtins__, 'True'):
794-
self.assertTrue(options.verbose is True)
792+
self.assertTrue(options.verbose is True)
795793

796794
def test_bool_flicker_on_and_off(self):
797795
self.assertParseOK(["-qvq", "-q", "-v"],

Lib/test/test_tcl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def testLoadWithUNC(self):
143143
fullname[0],
144144
fullname[3:])
145145

146-
with test_support.EnvironmentVarGuard() as env:
146+
with support.EnvironmentVarGuard() as env:
147147
env.unset("TCL_LIBRARY")
148148
f = os.popen('%s -c "import Tkinter; print Tkinter"' % (unc_name,))
149149

Misc/NEWS

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ C-API
8484
Library
8585
-------
8686

87+
- Issue #7909: Do not touch paths with the special prefixes ``\\.\``
88+
or ``\\?\`` in ntpath.normpath().
89+
8790
- Issue #5146: Handle UID THREAD command correctly in imaplib.
8891

8992
- Issue #5147: Fix the header generated for cookie files written by
@@ -1551,8 +1554,8 @@ Extension Modules
15511554
an error. The _PY_STRUCT_FLOAT_COERCE constant has been removed.
15521555
The version number has been bumped to 0.3.
15531556

1554-
- Issue #5359: Readd the Berkley-DB detection code to allow _dbm be built
1555-
using Berkley-DB.
1557+
- Issue #5359: Readd the Berkeley DB detection code to allow _dbm be built
1558+
using Berkeley DB.
15561559

15571560
Tests
15581561
-----

Python/getversion.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const char *
99
Py_GetVersion(void)
1010
{
1111
static char version[250];
12-
PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s",
12+
PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s",
1313
PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
1414
return version;
1515
}

0 commit comments

Comments
 (0)