Commit Graph

37 Commits

Author SHA1 Message Date
Alexander Belopolsky 6c7a4182f5 Closes issue #20858: Enhancements/fixes to pure-python datetime module
This patch brings the pure-python datetime more in-line with the C
module.  Patch contributed by Brian Kearns, a PyPy developer.  PyPy
project has been running these modifications in PyPy2 stdlib.

This commit includes:

- General PEP8/cleanups;
- Better testing of argument types passed to constructors;
- Removal of duplicate operations;
- Optimization of timedelta creation;
- Caching the result of __hash__ like the C accelerator;
- Enhancements/bug fixes in tests.
2014-09-28 19:11:56 -04:00
Raymond Hettinger a22d8231a3 merge 2014-07-25 15:00:30 -07:00
Raymond Hettinger 5a2146a2fd Issue #22044: Fixed premature DECREF in call_tzinfo_method. 2014-07-25 14:59:48 -07:00
Benjamin Peterson ee6bdc07d6 remove the ability of datetime.time to be considered false (closes #13936) 2014-03-20 18:00:35 -05:00
Zachary Ware 101d9e7250 Issue 19572: More silently skipped tests explicitly skipped. 2013-12-08 00:44:27 -06:00
Zachary Ware 9fe6d86709 Issue 19572: More silently skipped tests explicitly skipped. 2013-12-08 00:20:35 -06:00
Serhiy Storchaka 9289713c0b Issue #19605: Use specific asserts in datetime tests 2013-11-17 13:03:07 +02:00
Serhiy Storchaka 3df4dcceb9 Issue #19605: Use specific asserts in datetime tests 2013-11-17 12:52:33 +02:00
Ezio Melotti a7e7497d88 #18466: merge with 3.3. 2013-08-17 16:58:13 +03:00
Ezio Melotti 85a8629d21 #18466: fix more typos. Patch by Févry Thibault. 2013-08-17 16:57:41 +03:00
Alexander Belopolsky 790d269d39 Fixes #8860: Round half-microseconds to even in the timedelta constructor.
(Original patch by Mark Dickinson.)
2013-08-04 14:51:35 -04:00
Georg Brandl 0085a24075 Closes #15973: fix a segmentation fault when comparing timezone objects. 2012-09-22 09:23:12 +02:00
Alexander Belopolsky 93c9cd07b6 Issue #9527: tm_gmtoff has 'correct' sign. 2012-06-22 16:04:19 -04:00
Alexander Belopolsky ff493c9c46 Issue #9527: datetime.astimezone() method will now supply a class
timezone instance corresponding to the system local timezone when
called with no arguments.
2012-06-22 12:25:57 -04:00
Alexander Belopolsky fdc860f310 Issue #9527: datetime.astimezone() method will now supply a class
timezone instance corresponding to the system local timezone when
called with no arguments.
2012-06-22 12:23:23 -04:00
Alexander Belopolsky 0831382d69 Issue #15006: Allow equality comparison between naive and aware time
or datetime objects.
2012-06-15 20:19:47 -04:00
Alexander Belopolsky f6f56183ee Relax datetime.timestamp() test around DST change 2012-06-08 13:00:27 -04:00
Alexander Belopolsky 0c687e5e88 Relax datetime.timestamp() test around DST change 2012-06-08 12:58:31 -04:00
Alexander Belopolsky a4415141da Issue #2736: Added datetime.timestamp() method. 2012-06-08 12:33:09 -04:00
Victor Stinner 8050ca9c6f Issue #14180: TestDateTime.test_microsecond_rounding() handles localtime() and
gmtime() failure on Windows
2012-03-14 00:17:05 +01:00
Victor Stinner 5d272cc6a2 Close #14180: Factorize code to convert a number of seconds to time_t, timeval or timespec
time.ctime(), gmtime(), time.localtime(), datetime.date.fromtimestamp(),
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
raises an OverflowError, instead of a ValueError, if the timestamp does not fit
in time_t.

datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
round microseconds towards zero instead of rounding to nearest with ties going
away from zero.
2012-03-13 13:35:55 +01:00
Georg Brandl 2fb477c0f0 Merge 3.2: Issue #13703 plus some related test suite fixes. 2012-02-21 00:33:36 +01:00
Georg Brandl e5a0e0a75f Fix obscure failures of datetime-related tests due to the datetime tests failing to restore the system state completely after testing the pure-Python versions. 2012-02-20 23:37:36 +01:00
Florent Xicluna 49ce06858b Strengthen the tests for format '%Y', in relation with issue #13305. 2011-11-01 12:56:14 +01:00
Alexander Belopolsky 4409493d73 Relax %Y test. 2011-05-02 13:48:09 -04:00
Alexander Belopolsky 89da349b7b Issue #11930: Remove year >= 1000 limitation from datetime.strftime.
Patch by Victor Stinner.
2011-05-02 13:14:24 -04:00
Alexander Belopolsky b6f5ec7370 Issue #11576: Fixed timedelta subtraction glitch on big timedelta values 2011-04-05 20:07:38 -04:00
Ezio Melotti 3b3499ba69 #11565: Merge with 3.1. 2011-03-16 11:35:38 +02:00
Alexander Belopolsky b8bb4664fc Issue #1777412: extended year range of strftime down to 1000. 2011-01-08 00:13:34 +00:00
Raymond Hettinger 7beae8a0d5 Issue 10825: Minor updates to the test suite. 2011-01-06 05:34:17 +00:00
Alexander Belopolsky e239d23e8c Issue #6697: Fixed instances of _PyUnicode_AsString() result not checked for NULL 2010-12-08 23:31:48 +00:00
Eric Smith 3ab08cadae Issue #10624: Use support.requires_IEEE_754 in all appropriate tests. 2010-12-04 15:17:38 +00:00
Alexander Belopolsky 1bcbaab15a Issue 9183: Intern UTC timezone. 2010-10-14 17:03:51 +00:00
Alexander Belopolsky 3e62f78c4e Fixed microsecond rounding in python version of utcfromtimestamp 2010-09-21 16:30:56 +00:00
Georg Brandl 38005e8156 #9440: Remove borderline test case that fails based on unpredictable conditions such as compiler flags. 2010-07-31 18:11:07 +00:00
Alexander Belopolsky aeb039863d Make python version of fromtimestamp behave more like C. 2010-07-26 02:36:41 +00:00
Alexander Belopolsky cf86e368eb Issue #7989: Added pure python implementation of the datetime module. 2010-07-23 19:25:47 +00:00