[Python-3000-checkins] r63340 - in python/branches/py3k: .bzrignore Doc/library/os.rst Doc/library/othergui.rst Doc/library/rlcompleter.rst Doc/library/tk.rst Doc/library/zipimport.rst Lib/distutils/tests/test_dist.py Lib/lib-tk/Tkinter.py Lib/rlcompleter.py Lib/sched.py Lib/test/test_eof.py Lib/test/test_zipimport.py Lib/unittest.py Misc/NEWS Modules/zipimport.c Objects/unicodeobject.c Python/pythonrun.c

alexandre.vassalotti python-3000-checkins at python.org
Fri May 16 02:41:42 CEST 2008


Author: alexandre.vassalotti
Date: Fri May 16 02:41:41 2008
New Revision: 63340

Log:
Merged revisions 63066-63076,63079,63081-63085,63087-63097,63099,63101-63104 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r63066 | georg.brandl | 2008-05-11 10:56:04 -0400 (Sun, 11 May 2008) | 2 lines
  
  #2709 followup: better description of Tk's pros and cons.
........
  r63067 | georg.brandl | 2008-05-11 11:05:13 -0400 (Sun, 11 May 2008) | 2 lines
  
  #1326: document and test zipimporter.archive and zipimporter.prefix.
........
  r63068 | georg.brandl | 2008-05-11 11:07:39 -0400 (Sun, 11 May 2008) | 2 lines
  
  #2816: clarify error messages for EOF while scanning strings.
........
  r63069 | georg.brandl | 2008-05-11 11:17:41 -0400 (Sun, 11 May 2008) | 3 lines
  
  #2787: Flush stdout after writing test name, helpful when running
  hanging or long-running tests. Patch by Adam Olsen.
........
  r63070 | georg.brandl | 2008-05-11 11:20:16 -0400 (Sun, 11 May 2008) | 3 lines
  
  #2803: fix wrong invocation of heappush in seldom-reached code.
  Thanks to Matt Harden.
........
  r63073 | benjamin.peterson | 2008-05-11 12:38:07 -0400 (Sun, 11 May 2008) | 2 lines
  
  broaden .bzrignore
........
  r63076 | andrew.kuchling | 2008-05-11 15:15:52 -0400 (Sun, 11 May 2008) | 1 line
  
  Add message to test assertion
........
  r63083 | andrew.kuchling | 2008-05-11 16:08:33 -0400 (Sun, 11 May 2008) | 1 line
  
  Try setting HOME env.var to fix test on Win32
........
  r63092 | georg.brandl | 2008-05-11 16:53:55 -0400 (Sun, 11 May 2008) | 2 lines
  
  #2809 followup: even better split docstring.
........
  r63094 | georg.brandl | 2008-05-11 17:03:42 -0400 (Sun, 11 May 2008) | 4 lines
  
  - #2250: Exceptions raised during evaluation of names in rlcompleter's
    ``Completer.complete()`` method are now caught and ignored.
........
  r63095 | georg.brandl | 2008-05-11 17:16:37 -0400 (Sun, 11 May 2008) | 2 lines
  
  Clarify os.strerror()s exception behavior.
........
  r63097 | georg.brandl | 2008-05-11 17:34:10 -0400 (Sun, 11 May 2008) | 2 lines
  
  #2535: remove duplicated method.
........
  r63104 | alexandre.vassalotti | 2008-05-11 19:04:27 -0400 (Sun, 11 May 2008) | 2 lines
  
  Moved the Queue module stub in lib-old.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/.bzrignore
   python/branches/py3k/Doc/library/os.rst
   python/branches/py3k/Doc/library/othergui.rst
   python/branches/py3k/Doc/library/rlcompleter.rst
   python/branches/py3k/Doc/library/tk.rst
   python/branches/py3k/Doc/library/zipimport.rst
   python/branches/py3k/Lib/distutils/tests/test_dist.py
   python/branches/py3k/Lib/lib-tk/Tkinter.py
   python/branches/py3k/Lib/rlcompleter.py
   python/branches/py3k/Lib/sched.py
   python/branches/py3k/Lib/test/test_eof.py
   python/branches/py3k/Lib/test/test_zipimport.py
   python/branches/py3k/Lib/unittest.py
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Modules/zipimport.c
   python/branches/py3k/Objects/unicodeobject.c
   python/branches/py3k/Python/pythonrun.c

Modified: python/branches/py3k/.bzrignore
==============================================================================
--- python/branches/py3k/.bzrignore	(original)
+++ python/branches/py3k/.bzrignore	Fri May 16 02:41:41 2008
@@ -41,7 +41,5 @@
 Modules/config.c
 Parser/pgen
 Lib/plat-mac/errors.rsrc.df.rsrc
-Lib/lib2to3/Grammar2.6.0.alpha.1.pickle
-Lib/lib2to3/Grammar2.6.0.alpha.2.pickle
-Lib/lib2to3/PatternGrammar2.6.0.alpha.1.pickle
-Lib/lib2to3/PatternGrammar2.6.0.alpha.2.pickle
+Lib/lib2to3/Grammar*.pickle
+Lib/lib2to3/PatternGrammar*.pickle

Modified: python/branches/py3k/Doc/library/os.rst
==============================================================================
--- python/branches/py3k/Doc/library/os.rst	(original)
+++ python/branches/py3k/Doc/library/os.rst	Fri May 16 02:41:41 2008
@@ -274,7 +274,8 @@
 .. function:: strerror(code)
 
    Return the error message corresponding to the error code in *code*.
-   Availability: Unix, Windows.
+   On platforms where :cfunc:`strerror` returns ``NULL`` when given an unknown
+   error number, :exc:`ValueError` is raised.  Availability: Unix, Windows.
 
 
 .. function:: umask(mask)

Modified: python/branches/py3k/Doc/library/othergui.rst
==============================================================================
--- python/branches/py3k/Doc/library/othergui.rst	(original)
+++ python/branches/py3k/Doc/library/othergui.rst	Fri May 16 02:41:41 2008
@@ -69,10 +69,9 @@
       <http://www.amazon.com/exec/obidos/ASIN/1932394621>`_, by Noel Rappin and
       Robin Dunn.
 
-PyGTK, PyQt, and wxPython, all have a modern look and feel and far more
-widgets and better documentation than Tkinter. In addition,
-there are many other GUI toolkits for Python, both cross-platform, and
-platform-specific. See the `GUI Programming
+PyGTK, PyQt, and wxPython, all have a modern look and feel and more
+widgets than Tkinter. In addition, there are many other GUI toolkits for 
+Python, both cross-platform, and platform-specific. See the `GUI Programming
 <http://wiki.python.org/moin/GuiProgramming>`_ page in the Python Wiki for a
 much more complete list, and also for links to documents where the
 different GUI toolkits are compared.

Modified: python/branches/py3k/Doc/library/rlcompleter.rst
==============================================================================
--- python/branches/py3k/Doc/library/rlcompleter.rst	(original)
+++ python/branches/py3k/Doc/library/rlcompleter.rst	Fri May 16 02:41:41 2008
@@ -61,5 +61,6 @@
    If called for a dotted name, it will try to evaluate anything without obvious
    side-effects (functions will not be evaluated, but it can generate calls to
    :meth:`__getattr__`) up to the last part, and find matches for the rest via the
-   :func:`dir` function.
+   :func:`dir` function.  Any exception raised during the evaluation of the 
+   expression is caught, silenced and :const:`None` is returned.
 

Modified: python/branches/py3k/Doc/library/tk.rst
==============================================================================
--- python/branches/py3k/Doc/library/tk.rst	(original)
+++ python/branches/py3k/Doc/library/tk.rst	Fri May 16 02:41:41 2008
@@ -22,11 +22,12 @@
 mechanism which allows Python and Tcl to interact.
 
 :mod:`Tkinter`'s chief virtues are that it is fast, and that it usually comes
-bundled with Python. Although it has been used to create some very good
-applications, including IDLE, its standard documentation is weak (but there
-are some good books and tutorials), and it has an outdated look and
-feel. For more modern, better documented, and much more extensive GUI
-libraries, see the :ref:`other-gui-packages` section.
+bundled with Python. Although its standard documentation is weak, good 
+material is available, which includes: references, tutorials, a book and 
+others. :mod:`Tkinter` is also famous for having an outdated look and feel, 
+which has been vastly improved in Tk 8.5. Nevertheless, there are many other 
+GUI libraries that you could be interested in. For more information about 
+alternatives, see the :ref:`other-gui-packages` section.
 
 .. toctree::
    

Modified: python/branches/py3k/Doc/library/zipimport.rst
==============================================================================
--- python/branches/py3k/Doc/library/zipimport.rst	(original)
+++ python/branches/py3k/Doc/library/zipimport.rst	Fri May 16 02:41:41 2008
@@ -59,17 +59,14 @@
 
 .. class:: zipimporter(archivepath)
 
-   Create a new zipimporter instance. *archivepath* must be a path to a ZIP file.
+   Create a new zipimporter instance. *archivepath* must be a path to a ZIP
+   file, or to a specific path within a ZIP file.  For example, an *archivepath*
+   of :file:`foo/bar.zip/lib` will look for modules in the :file:`lib` directory
+   inside the ZIP file :file:`foo/bar.zip` (provided that it exists).
+
    :exc:`ZipImportError` is raised if *archivepath* doesn't point to a valid ZIP
    archive.
 
-   *archivepath* can also contain a path within the ZIP file -- the importer
-   object will then look under that path instead of the ZIP file root.  For
-   example, an *archivepath* of :file:`foo/bar.zip/lib` will look for modules
-   in the :file:`lib` directory inside the ZIP file :file:`foo/bar.zip`
-   (provided that it exists).
-
-
    .. method:: find_module(fullname[, path])
 
       Search for a module specified by *fullname*. *fullname* must be the fully
@@ -114,13 +111,19 @@
 
    .. attribute:: archive
 
-      The file name of the importer's associated ZIP file.
+      The file name of the importer's associated ZIP file, without a possible
+      subpath.
 
 
    .. attribute:: prefix
 
-      The path within the ZIP file where modules are searched; see
-      :class:`zipimporter` for details.
+      The subpath within the ZIP file where modules are searched.  This is the
+      empty string for zipimporter objects which point to the root of the ZIP
+      file.
+
+   The :attr:`archive` and :attr:`prefix` attributes, when combined with a
+   slash, equal the original *archivepath* argument given to the
+   :class:`zipimporter` constructor.
 
 
 .. _zipimport-examples:

Modified: python/branches/py3k/Lib/distutils/tests/test_dist.py
==============================================================================
--- python/branches/py3k/Lib/distutils/tests/test_dist.py	(original)
+++ python/branches/py3k/Lib/distutils/tests/test_dist.py	Fri May 16 02:41:41 2008
@@ -213,9 +213,10 @@
             # win32-style
             if sys.platform == 'win32':
                 # home drive should be found
-                os.environ['HOMEPATH'] = curdir
+                os.environ['HOME'] = curdir
                 files = dist.find_config_files()
-                self.assert_(user_filename in files)
+                self.assert_(user_filename in files,
+                             '%r not found in %r' % (user_filename, files))
         finally:
             for key, value in old.items():
                 if value is None:

Modified: python/branches/py3k/Lib/lib-tk/Tkinter.py
==============================================================================
--- python/branches/py3k/Lib/lib-tk/Tkinter.py	(original)
+++ python/branches/py3k/Lib/lib-tk/Tkinter.py	Fri May 16 02:41:41 2008
@@ -589,9 +589,6 @@
         status = self.tk.call('grab', 'status', self._w)
         if status == 'none': status = None
         return status
-    def lower(self, belowThis=None):
-        """Lower this widget in the stacking order."""
-        self.tk.call('lower', self._w, belowThis)
     def option_add(self, pattern, value, priority = None):
         """Set a VALUE (second parameter) for an option
         PATTERN (first parameter).

Modified: python/branches/py3k/Lib/rlcompleter.py
==============================================================================
--- python/branches/py3k/Lib/rlcompleter.py	(original)
+++ python/branches/py3k/Lib/rlcompleter.py	Fri May 16 02:41:41 2008
@@ -121,7 +121,10 @@
         if not m:
             return []
         expr, attr = m.group(1, 3)
-        object = eval(expr, self.namespace)
+        try:
+            object = eval(expr, self.namespace)
+        except Exception:
+            return []
         words = dir(object)
         if hasattr(object,'__class__'):
             words.append('__class__')

Modified: python/branches/py3k/Lib/sched.py
==============================================================================
--- python/branches/py3k/Lib/sched.py	(original)
+++ python/branches/py3k/Lib/sched.py	Fri May 16 02:41:41 2008
@@ -117,7 +117,7 @@
                     action(*argument)
                     delayfunc(0)   # Let other threads run
                 else:
-                    heapq.heappush(event)
+                    heapq.heappush(q, event)
 
     @property
     def queue(self):

Modified: python/branches/py3k/Lib/test/test_eof.py
==============================================================================
--- python/branches/py3k/Lib/test/test_eof.py	(original)
+++ python/branches/py3k/Lib/test/test_eof.py	Fri May 16 02:41:41 2008
@@ -6,7 +6,7 @@
 
 class EOFTestCase(unittest.TestCase):
     def test_EOFC(self):
-        expect = "EOL while scanning single-quoted string (<string>, line 1)"
+        expect = "EOL while scanning string literal (<string>, line 1)"
         try:
             eval("""'this is a test\
             """)
@@ -16,7 +16,8 @@
             raise test_support.TestFailed
 
     def test_EOFS(self):
-        expect = "EOF while scanning triple-quoted string (<string>, line 1)"
+        expect = ("EOF while scanning triple-quoted string literal "
+                  "(<string>, line 1)")
         try:
             eval("""'''this is a test""")
         except SyntaxError as msg:

Modified: python/branches/py3k/Lib/test/test_zipimport.py
==============================================================================
--- python/branches/py3k/Lib/test/test_zipimport.py	(original)
+++ python/branches/py3k/Lib/test/test_zipimport.py	Fri May 16 02:41:41 2008
@@ -209,6 +209,7 @@
             z.close()
 
             zi = zipimport.zipimporter(TEMP_ZIP)
+            self.assertEquals(zi.archive, TEMP_ZIP)
             self.assertEquals(zi.is_package(TESTPACK), True)
             zi.load_module(TESTPACK)
 
@@ -229,6 +230,37 @@
             z.close()
             os.remove(TEMP_ZIP)
 
+    def testZipImporterMethodsInSubDirectory(self):
+        packdir = TESTPACK + os.sep
+        packdir2 = packdir + TESTPACK2 + os.sep
+        files = {packdir2 + "__init__" + pyc_ext: (NOW, test_pyc),
+                 packdir2 + TESTMOD + pyc_ext: (NOW, test_pyc)}
+
+        z = ZipFile(TEMP_ZIP, "w")
+        try:
+            for name, (mtime, data) in files.items():
+                zinfo = ZipInfo(name, time.localtime(mtime))
+                zinfo.compress_type = self.compression
+                z.writestr(zinfo, data)
+            z.close()
+
+            zi = zipimport.zipimporter(TEMP_ZIP + os.sep + packdir)
+            self.assertEquals(zi.archive, TEMP_ZIP)
+            self.assertEquals(zi.prefix, packdir)
+            self.assertEquals(zi.is_package(TESTPACK2), True)
+            zi.load_module(TESTPACK2)
+
+            self.assertEquals(zi.is_package(TESTPACK2 + os.sep + '__init__'), False)
+            self.assertEquals(zi.is_package(TESTPACK2 + os.sep + TESTMOD), False)
+
+            mod_name = TESTPACK2 + os.sep + TESTMOD
+            mod = __import__(module_path_to_dotted_name(mod_name))
+            self.assertEquals(zi.get_source(TESTPACK2), None)
+            self.assertEquals(zi.get_source(mod_name), None)
+        finally:
+            z.close()
+            os.remove(TEMP_ZIP)
+
     def testGetData(self):
         z = ZipFile(TEMP_ZIP, "w")
         z.compression = self.compression

Modified: python/branches/py3k/Lib/unittest.py
==============================================================================
--- python/branches/py3k/Lib/unittest.py	(original)
+++ python/branches/py3k/Lib/unittest.py	Fri May 16 02:41:41 2008
@@ -679,6 +679,7 @@
         if self.showAll:
             self.stream.write(self.getDescription(test))
             self.stream.write(" ... ")
+            self.stream.flush()
 
     def addSuccess(self, test):
         TestResult.addSuccess(self, test)
@@ -686,6 +687,7 @@
             self.stream.writeln("ok")
         elif self.dots:
             self.stream.write('.')
+            self.stream.flush()
 
     def addError(self, test, err):
         TestResult.addError(self, test, err)
@@ -693,6 +695,7 @@
             self.stream.writeln("ERROR")
         elif self.dots:
             self.stream.write('E')
+            self.stream.flush()
 
     def addFailure(self, test, err):
         TestResult.addFailure(self, test, err)
@@ -700,6 +703,7 @@
             self.stream.writeln("FAIL")
         elif self.dots:
             self.stream.write('F')
+            self.stream.flush()
 
     def printErrors(self):
         if self.dots or self.showAll:

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Fri May 16 02:41:41 2008
@@ -28,6 +28,9 @@
 Library
 -------
 
+- #2250: Exceptions raised during evaluation of names in rlcompleter's
+  ``Completer.complete()`` method are now caught and ignored.
+
 - #2659: Added ``break_on_hyphens`` option to textwrap TextWrapper class.
 
 - Issue #2487: change the semantics of math.ldexp(x, n) when n is too

Modified: python/branches/py3k/Modules/zipimport.c
==============================================================================
--- python/branches/py3k/Modules/zipimport.c	(original)
+++ python/branches/py3k/Modules/zipimport.c	Fri May 16 02:41:41 2008
@@ -545,8 +545,15 @@
 "zipimporter(archivepath) -> zipimporter object\n\
 \n\
 Create a new zipimporter instance. 'archivepath' must be a path to\n\
-a zipfile. ZipImportError is raised if 'archivepath' doesn't point to\n\
-a valid Zip archive.");
+a zipfile, or to a specific path inside a zipfile. For example, it can be\n\
+'/tmp/myimport.zip', or '/tmp/myimport.zip/mydirectory', if mydirectory is a\n\
+valid directory inside the archive.\n\
+\n\
+'ZipImportError is raised if 'archivepath' doesn't point to a valid Zip\n\
+archive.\n\
+\n\
+The 'archive' attribute of zipimporter objects contains the name of the\n\
+zipfile targeted.");
 
 #define DEFERRED_ADDRESS(ADDR) 0
 

Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c	(original)
+++ python/branches/py3k/Objects/unicodeobject.c	Fri May 16 02:41:41 2008
@@ -7730,8 +7730,8 @@
 Return a list of the words in S, using sep as the\n\
 delimiter string.  If maxsplit is given, at most maxsplit\n\
 splits are done. If sep is not specified or is None, any\n\
-whitespace string is a separator and leading and trailing\n\
-whitespace is stripped before splitting.");
+whitespace string is a separator and empty strings are\n\
+removed from the result.");
 
 static PyObject*
 unicode_split(PyUnicodeObject *self, PyObject *args)

Modified: python/branches/py3k/Python/pythonrun.c
==============================================================================
--- python/branches/py3k/Python/pythonrun.c	(original)
+++ python/branches/py3k/Python/pythonrun.c	Fri May 16 02:41:41 2008
@@ -1690,10 +1690,10 @@
 		msg = "invalid token";
 		break;
 	case E_EOFS:
-		msg = "EOF while scanning triple-quoted string";
+		msg = "EOF while scanning triple-quoted string literal";
 		break;
 	case E_EOLS:
-		msg = "EOL while scanning single-quoted string";
+		msg = "EOL while scanning string literal";
 		break;
 	case E_INTR:
 		if (!PyErr_Occurred())


More information about the Python-3000-checkins mailing list