summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/datetime.rst18
-rw-r--r--Modules/_ctypes/ctypes.h4
2 files changed, 22 insertions, 0 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index 3789beb..6ead309 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -233,6 +233,14 @@ Supported operations:
| ``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 @@ Notes:
(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).
diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h
index e0bad07..0af5fa1 100644
--- a/Modules/_ctypes/ctypes.h
+++ b/Modules/_ctypes/ctypes.h
@@ -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))