[Python-checkins] cpython (merge 3.3 -> 3.3): merge heads in 3.3

gregory.p.smith python-checkins at python.org
Tue Mar 19 23:34:05 CET 2013


http://hg.python.org/cpython/rev/b3385d7aee7c
changeset:   82789:b3385d7aee7c
branch:      3.3
parent:      82787:f23274357fc8
parent:      82774:4e59a7fc69c6
user:        Gregory P. Smith <greg at krypto.org>
date:        Tue Mar 19 15:05:52 2013 -0700
summary:
  merge heads in 3.3

files:
  Doc/library/http.client.rst               |   6 +-
  Lib/imaplib.py                            |   3 +
  Lib/pydoc.py                              |   5 +-
  Lib/test/test_pydoc.py                    |  24 +++++++++++
  Lib/test/test_urllib2.py                  |   3 +
  Lib/tkinter/test/test_ttk/test_widgets.py |   2 +-
  Misc/ACKS                                 |   1 +
  Misc/NEWS                                 |   9 ++++
  Modules/_cursesmodule.c                   |   4 +-
  9 files changed, 51 insertions(+), 6 deletions(-)


diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -51,7 +51,7 @@
    .. versionchanged:: 3.2
       *source_address* was added.
 
-   .. versionchanged:: 3.2
+   .. deprecated-removed:: 3.2 3.4
       The *strict* parameter is deprecated.  HTTP 0.9-style "Simple Responses"
       are not supported anymore.
 
@@ -89,7 +89,7 @@
       This class now supports HTTPS virtual hosts if possible (that is,
       if :data:`ssl.HAS_SNI` is true).
 
-   .. versionchanged:: 3.2
+   .. deprecated-removed:: 3.2 3.4
       The *strict* parameter is deprecated.  HTTP 0.9-style "Simple Responses"
       are not supported anymore.
 
@@ -99,7 +99,7 @@
    Class whose instances are returned upon successful connection.  Not
    instantiated directly by user.
 
-   .. versionchanged:: 3.2
+   .. deprecated-removed:: 3.2 3.4
       The *strict* parameter is deprecated.  HTTP 0.9-style "Simple Responses"
       are not supported anymore.
 
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -24,6 +24,8 @@
 
 import binascii, errno, random, re, socket, subprocess, sys, time, calendar
 from datetime import datetime, timezone, timedelta
+from io import DEFAULT_BUFFER_SIZE
+
 try:
     import ssl
     HAVE_SSL = True
@@ -1244,6 +1246,7 @@
         self.sock = None
         self.file = None
         self.process = subprocess.Popen(self.command,
+            bufsize=DEFAULT_BUFFER_SIZE,
             stdin=subprocess.PIPE, stdout=subprocess.PIPE,
             shell=True, close_fds=True)
         self.writefile = self.process.stdin
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -132,7 +132,10 @@
     return _re_stripid.sub(r'\1', text)
 
 def _is_some_method(obj):
-    return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj)
+    return (inspect.isfunction(obj) or
+            inspect.ismethod(obj) or
+            inspect.isbuiltin(obj) or
+            inspect.ismethoddescriptor(obj))
 
 def allmethods(cl):
     methods = {}
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -395,6 +395,30 @@
             synopsis = pydoc.synopsis(TESTFN, {})
             self.assertEqual(synopsis, 'line 1: h\xe9')
 
+    def test_allmethods(self):
+        # issue 17476: allmethods was no longer returning unbound methods.
+        # This test is a bit fragile in the face of changes to object and type,
+        # but I can't think of a better way to do it without duplicating the
+        # logic of the function under test.
+
+        class TestClass(object):
+            def method_returning_true(self):
+                return True
+
+        # What we expect to get back: everything on object...
+        expected = dict(vars(object))
+        # ...plus our unbound method...
+        expected['method_returning_true'] = TestClass.method_returning_true
+        # ...but not the non-methods on object.
+        del expected['__doc__']
+        del expected['__class__']
+        # inspect resolves descriptors on type into methods, but vars doesn't,
+        # so we need to update __subclasshook__.
+        expected['__subclasshook__'] = TestClass.__subclasshook__
+
+        methods = pydoc.allmethods(TestClass)
+        self.assertDictEqual(methods, expected)
+
 
 class PydocImportTest(unittest.TestCase):
 
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -64,6 +64,9 @@
         for string, list in tests:
             self.assertEqual(urllib.request.parse_http_list(string), list)
 
+    def test_URLError_reasonstr(self):
+        err = urllib.error.URLError('reason')
+        self.assertIn(err.reason, str(err))
 
 def test_request_headers_dict():
     """
diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py
--- a/Lib/tkinter/test/test_ttk/test_widgets.py
+++ b/Lib/tkinter/test/test_ttk/test_widgets.py
@@ -947,7 +947,7 @@
             anchor=1)
 
     # XXX skipping for now; should be fixed to work with newer ttk
-    @unittest.skip
+    @unittest.skip("skipping pending resolution of Issue #10734")
     def test_heading_callback(self):
         def simulate_heading_click(x, y):
             support.simulate_mouse_click(self.tv, x, y)
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1216,6 +1216,7 @@
 Matthias Troffaes
 Tom Tromey
 John Tromp
+Diane Trout
 Jason Trowbridge
 Brent Tubbs
 Anthony Tuininga
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -197,6 +197,15 @@
   specifically addresses a stack misalignment issue on x86 and issues on
   some more recent platforms.
 
+- Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal.
+
+- Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO
+  in subprocess, but the imap code assumes buffered IO.  In Python2 this
+  worked by accident.  IMAP4_stream now explicitly uses buffered IO.
+
+- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc
+  'allmethods'; it was missing unbound methods on the class.
+
 - Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module.
 
 - Issue #16389: Fixed a performance regression relative to Python 3.1 in the
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -1138,7 +1138,9 @@
     }
     if (rtn == ERR) {
         /* getch() returns ERR in nodelay mode */
-        PyErr_SetString(PyCursesError, "no input");
+        PyErr_CheckSignals();
+        if (!PyErr_Occurred())
+            PyErr_SetString(PyCursesError, "no input");
         return NULL;
     } else if (rtn<=255) {
         return Py_BuildValue("C", rtn);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list