[Python-checkins] r83433 - in python/branches/release31-maint: Doc/library/datetime.rst Modules/_ctypes/ctypes.h

georg.brandl python-checkins at python.org
Sun Aug 1 21:21:34 CEST 2010


Author: georg.brandl
Date: Sun Aug  1 21:21:34 2010
New Revision: 83433

Log:
Merged revisions 83325,83328,83341 via svnmerge from 
svn+ssh://svn.python.org/python/branches/py3k

........
  r83325 | georg.brandl | 2010-07-31 11:37:03 +0200 (Sa, 31 Jul 2010) | 1 line
  
  Copy Sun-specific inclusion of <alloca.h> from 2.7 maint to trunk; it seems to not have been merged to py3k.
........
  r83328 | raymond.hettinger | 2010-07-31 12:14:41 +0200 (Sa, 31 Jul 2010) | 1 line
  
  Document how to change OrderedDict update order from first to last.
........
  r83341 | georg.brandl | 2010-07-31 13:40:07 +0200 (Sa, 31 Jul 2010) | 1 line
  
  #9430: document timedelta str() and repr().
........


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Doc/library/datetime.rst
   python/branches/release31-maint/Modules/_ctypes/ctypes.h

Modified: python/branches/release31-maint/Doc/library/datetime.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/datetime.rst	(original)
+++ python/branches/release31-maint/Doc/library/datetime.rst	Sun Aug  1 21:21:34 2010
@@ -233,6 +233,14 @@
 | ``abs(t)``                     | equivalent to +\ *t* when ``t.days >= 0``, and|
 |                                | to -*t* when ``t.days < 0``. (2)              |
 +--------------------------------+-----------------------------------------------+
+| ``str(t)``                     | Returns a string in the form                  |
+|                                | ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D  |
+|                                | is negative for negative ``t``. (5)           |
++--------------------------------+-----------------------------------------------+
+| ``repr(t)``                    | Returns a string in the form                  |
+|                                | ``datetime.timedelta(D[, S[, U]])``, where D  |
+|                                | is negative for negative ``t``. (5)           |
++--------------------------------+-----------------------------------------------+
 
 Notes:
 
@@ -248,6 +256,16 @@
 (4)
    -*timedelta.max* is not representable as a :class:`timedelta` object.
 
+(5)
+  String representations of :class:`timedelta` objects are normalized
+  similarly to their internal representation.  This leads to somewhat
+  unusual results for negative timedeltas.  For example:
+
+  >>> timedelta(hours=-5)
+  datetime.timedelta(-1, 68400)
+  >>> print(_)
+  -1 day, 19:00:00
+
 In addition to the operations listed above :class:`timedelta` objects support
 certain additions and subtractions with :class:`date` and :class:`datetime`
 objects (see below).

Modified: python/branches/release31-maint/Modules/_ctypes/ctypes.h
==============================================================================
--- python/branches/release31-maint/Modules/_ctypes/ctypes.h	(original)
+++ python/branches/release31-maint/Modules/_ctypes/ctypes.h	Sun Aug  1 21:21:34 2010
@@ -1,3 +1,7 @@
+#if defined (__SVR4) && defined (__sun)
+#   include <alloca.h>
+#endif
+
 #ifndef MS_WIN32
 #define max(a, b) ((a) > (b) ? (a) : (b))
 #define min(a, b) ((a) < (b) ? (a) : (b))


More information about the Python-checkins mailing list