[Python-checkins] r68259 - in python/branches/release30-maint: Doc/library/hashlib.rst Doc/library/stdtypes.rst Doc/library/subprocess.rst Lib/ssl.py Objects/bytesobject.c

georg.brandl python-checkins at python.org
Sun Jan 4 00:47:58 CET 2009


Author: georg.brandl
Date: Sun Jan  4 00:47:58 2009
New Revision: 68259

Log:
Merged revisions 67950,67962,67968-67969,68027,68075,68091,68093 via svnmerge from 
svn+ssh://svn.python.org/python/branches/py3k

........
  r67950 | benjamin.peterson | 2008-12-27 18:00:44 +0100 (Sat, 27 Dec 2008) | 1 line
  
  fix 2.x isms in distutils test
........
  r67962 | georg.brandl | 2008-12-27 20:08:11 +0100 (Sat, 27 Dec 2008) | 2 lines
  
  #4697: clarify that the functions are Unix-only.
........
  r67968 | georg.brandl | 2008-12-28 00:12:09 +0100 (Sun, 28 Dec 2008) | 2 lines
  
  Remove confusing error message in bytes.translate.
........
  r67969 | georg.brandl | 2008-12-28 00:33:20 +0100 (Sun, 28 Dec 2008) | 5 lines
  
  Document bytes.translate().
  
  BTW, having str.maketrans() as a static method and
  string.maketrans() as a function that creates translation tables for bytes objects is not very consistent :)
........
  r68027 | benjamin.peterson | 2008-12-29 21:52:09 +0100 (Mon, 29 Dec 2008) | 1 line
  
  hexdigest() doesn't return bytes #4771
........
  r68075 | benjamin.peterson | 2008-12-30 19:05:46 +0100 (Tue, 30 Dec 2008) | 2 lines
  
  use $(RUNSHARED) to run plat-mac/regen
........
  r68091 | benjamin.peterson | 2008-12-31 04:43:28 +0100 (Wed, 31 Dec 2008) | 1 line
  
  #4788 qualify remove a bare except
........
  r68093 | benjamin.peterson | 2008-12-31 05:10:35 +0100 (Wed, 31 Dec 2008) | 1 line
  
  fix name usage
........


Modified:
   python/branches/release30-maint/   (props changed)
   python/branches/release30-maint/Doc/library/hashlib.rst
   python/branches/release30-maint/Doc/library/stdtypes.rst
   python/branches/release30-maint/Doc/library/subprocess.rst
   python/branches/release30-maint/Lib/ssl.py
   python/branches/release30-maint/Objects/bytesobject.c

Modified: python/branches/release30-maint/Doc/library/hashlib.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/hashlib.rst	(original)
+++ python/branches/release30-maint/Doc/library/hashlib.rst	Sun Jan  4 00:47:58 2009
@@ -64,7 +64,7 @@
 More condensed:
 
    >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()
-   b'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'
+   'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'
 
 A generic :func:`new` constructor that takes the string name of the desired
 algorithm as its first parameter also exists to allow access to the above listed
@@ -76,7 +76,7 @@
    >>> h = hashlib.new('ripemd160')
    >>> h.update(b"Nobody inspects the spammish repetition")
    >>> h.hexdigest()
-   b'cc4a5ce1b3df48aec5d22d1f16b894a0b894eccc'
+   'cc4a5ce1b3df48aec5d22d1f16b894a0b894eccc'
 
 The following values are provided as constant attributes of the hash objects
 returned by the constructors:

Modified: python/branches/release30-maint/Doc/library/stdtypes.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/stdtypes.rst	(original)
+++ python/branches/release30-maint/Doc/library/stdtypes.rst	Sun Jan  4 00:47:58 2009
@@ -1086,13 +1086,12 @@
 .. method:: str.translate(map)
 
    Return a copy of the *s* where all characters have been mapped through the
-   *map* which must be a dictionary of Unicode ordinals(integers) to Unicode
+   *map* which must be a dictionary of Unicode ordinals (integers) to Unicode
    ordinals, strings or ``None``.  Unmapped characters are left untouched.
    Characters mapped to ``None`` are deleted.
 
-   You can use :meth:`str.maketrans` to create a translation table.  For string
-   objects, set the *table* argument to ``None`` for translations that only
-   delete characters:
+   You can use :meth:`str.maketrans` to create a translation map from
+   character-to-character mappings in different formats.
 
    .. note::
 
@@ -1495,23 +1494,23 @@
    >>> bytes.fromhex('f0 f1f2  ')
    b'\xf0\xf1\xf2'
 
-.. XXX verify/document translate() semantics!
-
-   .. method:: bytes.translate(table[, delete])
+The translate method differs in semantics from the version available on strings:
+   
+.. method:: bytes.translate(table[, delete])
 
-   Return a copy of the bytes object where all bytes occurring in the optional
-   argument *delete* are removed, and the remaining bytes have been mapped
-   through the given translation table, which must be a bytes object of length
-   256.
+   Return a copy of the bytes or bytearray object where all bytes occurring in
+   the optional argument *delete* are removed, and the remaining bytes have been
+   mapped through the given translation table, which must be a bytes object of
+   length 256.
 
-   You can use the :func:`maketrans` helper function in the :mod:`string` module to
-   create a translation table.
+   You can use the :func:`string.maketrans` helper function to create a
+   translation table.
 
-   .. XXX a None table doesn't seem to be supported
-      Set the *table* argument to ``None`` for translations that only delete characters::
+   Set the *table* argument to ``None`` for translations that only delete
+   characters::
 
-         >>> 'read this short text'.translate(None, 'aeiou')
-         'rd ths shrt txt'
+      >>> b'read this short text'.translate(None, b'aeiou')
+      b'rd ths shrt txt'
 
 
 .. _types-set:

Modified: python/branches/release30-maint/Doc/library/subprocess.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/subprocess.rst	(original)
+++ python/branches/release30-maint/Doc/library/subprocess.rst	Sun Jan  4 00:47:58 2009
@@ -173,6 +173,8 @@
       >>> subprocess.getstatusoutput('/bin/junk')
       (256, 'sh: /bin/junk: not found')
 
+   Availability: UNIX.
+
 
 .. function:: getoutput(cmd)
    Return output ``(stdout or stderr)`` of executing *cmd* in a shell.
@@ -184,6 +186,8 @@
       >>> subprocess.getoutput('ls /bin/ls')
       '/bin/ls'
 
+   Availability: UNIX.
+
 
 Exceptions
 ^^^^^^^^^^

Modified: python/branches/release30-maint/Lib/ssl.py
==============================================================================
--- python/branches/release30-maint/Lib/ssl.py	(original)
+++ python/branches/release30-maint/Lib/ssl.py	Sun Jan  4 00:47:58 2009
@@ -114,7 +114,7 @@
         # see if it's connected
         try:
             socket.getpeername(self)
-        except:
+        except socket_error:
             # no, no connection yet
             self._sslobj = None
         else:

Modified: python/branches/release30-maint/Objects/bytesobject.c
==============================================================================
--- python/branches/release30-maint/Objects/bytesobject.c	(original)
+++ python/branches/release30-maint/Objects/bytesobject.c	Sun Jan  4 00:47:58 2009
@@ -1884,11 +1884,6 @@
 			del_table = PyBytes_AS_STRING(delobj);
 			dellen = PyBytes_GET_SIZE(delobj);
 		}
-		else if (PyUnicode_Check(delobj)) {
-			PyErr_SetString(PyExc_TypeError,
-			"deletions are implemented differently for unicode");
-			return NULL;
-		}
 		else if (PyObject_AsCharBuffer(delobj, &del_table, &dellen))
 			return NULL;
 	}


More information about the Python-checkins mailing list