Skip to content

Commit 560f356

Browse files
author
georg.brandl
committed
Merged revisions 83352,83356-83358,83362,83366,83368-83369 via svnmerge from
svn+ssh://pythondev@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. ........ 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. ........ git-svn-id: http://svn.python.org/projects/python/branches/release27-maint@83429 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent eab2c0d commit 560f356

7 files changed

Lines changed: 21 additions & 13 deletions

File tree

Doc/library/sys.rst

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

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

979975

980976
.. data:: api_version

Lib/ntpath.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,12 @@ def normpath(path):
399399
"""Normalize path, eliminating double slashes, etc."""
400400
# Preserve unicode (if path is unicode)
401401
backslash, dot = (u'\\', u'.') if isinstance(path, unicode) else ('\\', '.')
402+
if path.startswith(('\\\\.\\', '\\\\?\\')):
403+
# in the case of paths with these prefixes:
404+
# \\.\ -> device names
405+
# \\?\ -> literal paths
406+
# do not do any normalization, but return the path unchanged
407+
return path
402408
path = path.replace("/", "\\")
403409
prefix, path = splitdrive(path)
404410
# We need to be careful here. If the prefix is empty, and the path starts

Lib/test/data/README

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This empty directory serves as destination for temporary files
2+
created by some tests.

Lib/test/test_ntpath.py

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

126+
tester("ntpath.normpath('\\\\.\\NUL')", r'\\.\NUL')
127+
tester("ntpath.normpath('\\\\?\\D:/XY\\Z')", r'\\?\D:/XY\Z')
128+
126129
def test_expandvars(self):
127130
with test_support.EnvironmentVarGuard() as env:
128131
env.clear()

Lib/test/test_optparse.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -791,15 +791,13 @@ def test_bool_false(self):
791791
(options, args) = self.assertParseOK(["-q"],
792792
{'verbose': 0},
793793
[])
794-
if hasattr(__builtins__, 'False'):
795-
self.assertTrue(options.verbose is False)
794+
self.assertTrue(options.verbose is False)
796795

797796
def test_bool_true(self):
798797
(options, args) = self.assertParseOK(["-v"],
799798
{'verbose': 1},
800799
[])
801-
if hasattr(__builtins__, 'True'):
802-
self.assertTrue(options.verbose is True)
800+
self.assertTrue(options.verbose is True)
803801

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

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Library
2727
- Issue #9448: Fix a leak of OS resources (mutexes or semaphores) when
2828
re-initializing a buffered IO object by calling its ``__init__`` method.
2929

30+
- Issue #7909: Do not touch paths with the special prefixes ``\\.\``
31+
or ``\\?\`` in ntpath.normpath().
32+
3033
- Issue #5146: Handle UID THREAD command correctly in imaplib.
3134

3235
- Issue #5147: Fix the header generated for cookie files written by

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)