summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2013-09-30 00:13:32 (GMT)
committerLarry Hastings <larry@hastings.org>2013-09-30 00:13:32 (GMT)
commitd92af0f1d9087c3526ac470dafec1449404e40f9 (patch)
tree34352ef08a7b007967c12f7f2db01dfc1c469d46 /Lib
parente9cbd181a20c667c7eda7c22774696501cfdc0f1 (diff)
parent5d23e6d54352db7c64d152dbabef798340127ccb (diff)
downloadcpython-d92af0f1d9087c3526ac470dafec1449404e40f9.zip
cpython-d92af0f1d9087c3526ac470dafec1449404e40f9.tar.gz
cpython-d92af0f1d9087c3526ac470dafec1449404e40f9.tar.bz2
Merge 3.4.0a3 release changes.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/command/build_ext.py7
-rw-r--r--Lib/distutils/tests/test_cmd.py25
-rw-r--r--Lib/site.py19
-rw-r--r--Lib/test/_test_multiprocessing.py8
-rw-r--r--Lib/test/test_complex.py1
-rw-r--r--Lib/test/test_dis.py4
-rw-r--r--Lib/test/test_ftplib.py4
-rw-r--r--Lib/test/test_import.py11
-rw-r--r--Lib/test/test_regrtest.py12
-rw-r--r--Lib/test/test_smtplib.py6
-rw-r--r--Lib/test/test_ssl.py8
-rw-r--r--Lib/test/test_webbrowser.py2
-rw-r--r--Lib/venv/__init__.py7
-rw-r--r--Lib/xml/dom/minidom.py3
14 files changed, 46 insertions, 71 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index a6aad53..80689b6 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -242,11 +242,10 @@ class build_ext(Command):
# building python standard extensions
self.library_dirs.append('.')
- # for extensions under Linux or Solaris with a shared Python library,
+ # For building extensions with a shared Python library,
# Python's library directory must be appended to library_dirs
- sysconfig.get_config_var('Py_ENABLE_SHARED')
- if (sys.platform.startswith(('linux', 'gnu', 'sunos'))
- and sysconfig.get_config_var('Py_ENABLE_SHARED')):
+ # See Issues: #1600860, #4366
+ if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
# building third party extensions
self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
diff --git a/Lib/distutils/tests/test_cmd.py b/Lib/distutils/tests/test_cmd.py
index 195045c..cf5197c 100644
--- a/Lib/distutils/tests/test_cmd.py
+++ b/Lib/distutils/tests/test_cmd.py
@@ -34,6 +34,18 @@ class CommandTestCase(unittest.TestCase):
self.assertRaises(DistutilsOptionError,
cmd.ensure_string_list, 'not_string_list2')
+ cmd.option1 = 'ok,dok'
+ cmd.ensure_string_list('option1')
+ self.assertEqual(cmd.option1, ['ok', 'dok'])
+
+ cmd.option2 = ['xxx', 'www']
+ cmd.ensure_string_list('option2')
+
+ cmd.option3 = ['ok', 2]
+ self.assertRaises(DistutilsOptionError, cmd.ensure_string_list,
+ 'option3')
+
+
def test_make_file(self):
cmd = self.cmd
@@ -77,19 +89,6 @@ class CommandTestCase(unittest.TestCase):
cmd.option3 = 1
self.assertRaises(DistutilsOptionError, cmd.ensure_string, 'option3')
- def test_ensure_string_list(self):
- cmd = self.cmd
- cmd.option1 = 'ok,dok'
- cmd.ensure_string_list('option1')
- self.assertEqual(cmd.option1, ['ok', 'dok'])
-
- cmd.option2 = ['xxx', 'www']
- cmd.ensure_string_list('option2')
-
- cmd.option3 = ['ok', 2]
- self.assertRaises(DistutilsOptionError, cmd.ensure_string_list,
- 'option3')
-
def test_ensure_filename(self):
cmd = self.cmd
cmd.option1 = __file__
diff --git a/Lib/site.py b/Lib/site.py
index 9f935a3..e1fa30e 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -405,12 +405,19 @@ def enablerlcompleter():
# want to ignore the exception.
pass
- history = os.path.join(os.path.expanduser('~'), '.python_history')
- try:
- readline.read_history_file(history)
- except IOError:
- pass
- atexit.register(readline.write_history_file, history)
+ if readline.get_history_item(1) is None:
+ # If no history was loaded, default to .python_history.
+ # The guard is necessary to avoid doubling history size at
+ # each interpreter exit when readline was already configured
+ # through a PYTHONSTARTUP hook, see:
+ # http://bugs.python.org/issue5845#msg198636
+ history = os.path.join(os.path.expanduser('~'),
+ '.python_history')
+ try:
+ readline.read_history_file(history)
+ except IOError:
+ pass
+ atexit.register(readline.write_history_file, history)
sys.__interactivehook__ = register_readline
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index 4cabf43..de0c968 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -3038,15 +3038,15 @@ class TestInitializers(unittest.TestCase):
# Verifies os.close(sys.stdin.fileno) vs. sys.stdin.close() behavior
#
-def _ThisSubProcess(q):
+def _this_sub_process(q):
try:
item = q.get(block=False)
except pyqueue.Empty:
pass
-def _TestProcess(q):
+def _test_process(q):
queue = multiprocessing.Queue()
- subProc = multiprocessing.Process(target=_ThisSubProcess, args=(queue,))
+ subProc = multiprocessing.Process(target=_this_sub_process, args=(queue,))
subProc.daemon = True
subProc.start()
subProc.join()
@@ -3085,7 +3085,7 @@ class TestStdinBadfiledescriptor(unittest.TestCase):
def test_queue_in_process(self):
queue = multiprocessing.Queue()
- proc = multiprocessing.Process(target=_TestProcess, args=(queue,))
+ proc = multiprocessing.Process(target=_test_process, args=(queue,))
proc.start()
proc.join()
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py
index 2a85bf4..f80d7ac 100644
--- a/Lib/test/test_complex.py
+++ b/Lib/test/test_complex.py
@@ -101,7 +101,6 @@ class ComplexTest(unittest.TestCase):
# FIXME: The following currently crashes on Alpha
# self.assertRaises(OverflowError, pow, 1e200+1j, 1e200+1j)
- def test_truediv(self):
self.assertAlmostEqual(complex.__truediv__(2+0j, 1+1j), 1-1j)
self.assertRaises(ZeroDivisionError, complex.__truediv__, 1+1j, 0+0j)
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index a1c6582..8610c5d 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -247,7 +247,6 @@ class DisTests(unittest.TestCase):
expected = _BIG_LINENO_FORMAT % (i + 2)
self.do_disassembly_test(func(i), expected)
- def test_big_linenos(self):
from test import dis_module
self.do_disassembly_test(dis_module, dis_module_expected_results)
@@ -273,9 +272,6 @@ class DisTests(unittest.TestCase):
pass
self.assertRaises(RuntimeError, dis.dis, None)
- def test_dis_object(self):
- self.assertRaises(TypeError, dis.dis, object())
-
def test_dis_traceback(self):
try:
del sys.last_traceback
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index 08d99d8..47563c8 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -534,10 +534,6 @@ class TestFTPClass(TestCase):
dir = self.client.cwd('/foo')
self.assertEqual(dir, '250 cwd ok')
- def test_mkd(self):
- dir = self.client.mkd('/foo')
- self.assertEqual(dir, '/foo')
-
def test_pwd(self):
dir = self.client.pwd()
self.assertEqual(dir, 'pwd ok')
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index 2485e22..9d15a43 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -252,17 +252,6 @@ class ImportTests(unittest.TestCase):
if TESTFN in sys.modules:
del sys.modules[TESTFN]
- def test_import_name_binding(self):
- # import x.y.z binds x in the current namespace.
- import test as x
- import test.support
- self.assertIs(x, test, x.__name__)
- self.assertTrue(hasattr(test.support, "__file__"))
-
- # import x.y.z as w binds z as w.
- import test.support as y
- self.assertIs(y, test.support, y.__name__)
-
def test_import_by_filename(self):
path = os.path.abspath(TESTFN)
encoding = sys.getfilesystemencoding()
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 353874b..a398a4f 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -167,19 +167,13 @@ class ParseArgsTestCase(unittest.TestCase):
self.assertEqual(ns.testdir, os.path.join(support.SAVEDCWD, 'foo'))
self.checkError(['--testdir'], 'expected one argument')
- def test_findleaks(self):
- for opt in '-l', '--findleaks':
- with self.subTest(opt=opt):
- ns = regrtest._parse_args([opt])
- self.assertTrue(ns.findleaks)
-
- def test_findleaks(self):
+ def test_runleaks(self):
for opt in '-L', '--runleaks':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt])
self.assertTrue(ns.runleaks)
- def test_findleaks(self):
+ def test_huntrleaks(self):
for opt in '-R', '--huntrleaks':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt, ':'])
@@ -207,7 +201,7 @@ class ParseArgsTestCase(unittest.TestCase):
self.checkError([opt, '2', '-l'], "don't go together")
self.checkError([opt, '2', '-M', '4G'], "don't go together")
- def test_findleaks(self):
+ def test_coverage(self):
for opt in '-T', '--coverage':
with self.subTest(opt=opt):
ns = regrtest._parse_args([opt])
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index 8f64ec1..a501f40 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -239,14 +239,14 @@ class DebuggingServerTests(unittest.TestCase):
self.assertEqual(smtp.rset(), expected)
smtp.quit()
- def testNotImplemented(self):
+ def testELHO(self):
# EHLO isn't implemented in DebuggingServer
smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
- expected = (502, b'Error: command "EHLO" not implemented')
+ expected = (250, b'\nSIZE 33554432\nHELP')
self.assertEqual(smtp.ehlo(), expected)
smtp.quit()
- def testNotImplemented(self):
+ def testEXPNNotImplemented(self):
# EXPN isn't implemented in DebuggingServer
smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3)
expected = (502, b'EXPN not implemented')
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 8915305..2605e68 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -1588,8 +1588,14 @@ else:
context.load_cert_chain(CERTFILE)
server = ThreadedEchoServer(context=context, chatty=False)
with server:
- s = context.wrap_socket(socket.socket())
+ s = context.wrap_socket(socket.socket(),
+ do_handshake_on_connect=False)
s.connect((HOST, server.port))
+ # getpeercert() raise ValueError while the handshake isn't
+ # done.
+ with self.assertRaises(ValueError):
+ s.getpeercert()
+ s.do_handshake()
cert = s.getpeercert()
self.assertTrue(cert, "Can't get peer certificate.")
cipher = s.cipher()
diff --git a/Lib/test/test_webbrowser.py b/Lib/test/test_webbrowser.py
index 34b9364..c3292c4 100644
--- a/Lib/test/test_webbrowser.py
+++ b/Lib/test/test_webbrowser.py
@@ -158,7 +158,7 @@ class OperaCommandTest(CommandTestMixin, unittest.TestCase):
options=['-remote'],
arguments=['openURL({},new-window)'.format(URL)])
- def test_open_new(self):
+ def test_open_new_tab(self):
self._test('open_new_tab',
options=['-remote'],
arguments=['openURL({},new-page)'.format(URL)])
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
index 8d807d7..1688bc4 100644
--- a/Lib/venv/__init__.py
+++ b/Lib/venv/__init__.py
@@ -25,18 +25,11 @@ optional arguments:
--upgrade Upgrade the environment directory to use this version
of Python, assuming Python has been upgraded in-place.
"""
-import base64
-import io
import logging
import os
-import os.path
import shutil
import sys
import sysconfig
-try:
- import threading
-except ImportError:
- threading = None
import types
logger = logging.getLogger(__name__)
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index 55c4ce1..6f71631 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -370,9 +370,6 @@ class Attr(Node):
except AttributeError:
return self.nodeName.split(":", 1)[-1]
- def _get_name(self):
- return self.name
-
def _get_specified(self):
return self.specified