summaryrefslogtreecommitdiffstats
path: root/Modules/_datetimemodule.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-31752: Fix possible crash in timedelta constructor called with custom ↵Miss Islington (bot)2017-10-231-2/+7
| | | | | | integers. (GH-3947) (#4086) Bad remainder in divmod() in intermediate calculations caused an assertion failure. (cherry picked from commit 4ffd4653a7ec9c97775472276cf5e159e2366bb2)
* [3.6] bpo-31293: Fix crashes in truediv and mul of a timedelta by a float ↵Miss Islington (bot)2017-09-191-4/+33
| | | | | with a bad as_integer_ratio() method. (GH-3227) (#3654) (cherry picked from commit 865e4b4f630e2ae91e61239258abb58b488f1d65)
* bpo-29953: Fix memory leaks in the replace() method of datetime and t… (#933)Serhiy Storchaka2017-03-311-11/+10
| | | | | objects when pass out of bound fold argument. (cherry picked from commit 314d6fca36a4eaa0541218431d14804fadec6488)
* Fix datetime.fromtimestamp(): check boundsVictor Stinner2017-02-101-21/+40
| | | | | Issue #29100: Fix datetime.fromtimestamp() regression introduced in Python 3.6.0: check minimum and maximum years.
* Issue #29140: Fix hash(datetime.time)Victor Stinner2017-01-031-5/+5
| | | | | | Fix time_hash() function: replace DATE_xxx() macros with TIME_xxx() macros. Before, the hash function used a wrong value for microseconds if fold is set (equal to 1).
* Issue #28752: Restored the __reduce__() methods of datetime objects.Serhiy Storchaka2016-11-211-8/+26
|
* Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSizeSerhiy Storchaka2016-11-201-2/+2
| | | | with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
* Issue #28148: Stop using localtime() and gmtime() in the time module.Alexander Belopolsky2016-09-281-51/+16
| | | | | | Introduced platform independent _PyTime_localtime API that is similar to POSIX localtime_r, but available on all platforms. Patch by Ed Schouten.
* stop using Py_LL and Py_ULLBenjamin Peterson2016-09-191-1/+1
|
* #28067: Fixed another typo.Alexander Belopolsky2016-09-101-1/+1
|
* #28067: Fixed a typo.Alexander Belopolsky2016-09-101-1/+1
|
* Closes #28067: Do not call localtime (gmtime) in datetime module.Alexander Belopolsky2016-09-101-42/+60
|
* fix dummy macroBenjamin Peterson2016-09-101-1/+2
|
* replace PY_LONG_LONG with long longBenjamin Peterson2016-09-061-12/+12
|
* Avoid inefficient way to call functions without argumentVictor Stinner2016-09-061-4/+4
| | | | | | Don't pass "()" format to PyObject_CallXXX() to call a function without argument: pass NULL as the format string instead. It avoids to have to parse a string to produce 0 argument.
* Issue #27809: tzinfo_reduce() uses fast callVictor Stinner2016-08-221-14/+10
|
* Closes #27710: Disallow fold not in [0, 1] in time and datetime constructors.Alexander Belopolsky2016-08-081-5/+23
|
* Closes #27661: Added tzinfo keyword argument to datetime.combine.Alexander Belopolsky2016-08-021-16/+20
|
* Issue 24773: Added a time_t overflow check.Alexander Belopolsky2016-07-251-1/+8
|
* Closes issue #24773: Implement PEP 495 (Local Time Disambiguation).Alexander Belopolsky2016-07-221-149/+526
|
* Issue #27171: Merge typo fixes from 3.5Martin Panter2016-06-021-2/+2
|\
| * Issue #27171: Fix typos in documentation, comments, and test function namesMartin Panter2016-06-021-2/+2
| |
* | Issue #27076: Merge spelling from 3.5Martin Panter2016-05-261-1/+1
|\ \ | |/
| * Issue #27076: Doc, comment and tests spelling fixesMartin Panter2016-05-261-1/+1
| | | | | | | | Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
* | Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREFSerhiy Storchaka2016-04-101-3/+3
|\ \ | |/ | | | | in places where Py_DECREF was used.
* | Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-3/+3
|\ \ | |/
* | mergeAlexander Belopolsky2016-03-251-1/+6
|\ \ | |/
| * Issue#26616:Fixed a bug in datetime.astimezone() method.Alexander Belopolsky2016-03-251-1/+6
| |
| * Closes issue #23600: Wrong results from tzinfo.fromutc().Alexander Belopolsky2015-09-281-1/+1
| |
* | Closes #19475: Added timespec to the datetime.isoformat() method.Alexander Belopolsky2016-03-061-28/+95
| | | | | | | | | | | | | | Added an optional argument timespec to the datetime isoformat() method to choose the precision of the time component. Original patch by Alessandro Cucci.
* | Issue #20440: Cleaning up the code by using Py_SETREF.Serhiy Storchaka2016-01-051-18/+6
| |
* | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-1/+1
| | | | | | | | private functions.
* | Issue #25923: Added the const qualifier to static constant arrays.Serhiy Storchaka2015-12-251-10/+10
| |
* | Issue #25558: Use compile-time asserts.Serhiy Storchaka2015-11-071-3/+3
| |
* | Closes issue #23600: Wrong results from tzinfo.fromutc().Alexander Belopolsky2015-09-281-1/+1
|\ \
| * \ Closes issue #23600: Wrong results from tzinfo.fromutc().Alexander Belopolsky2015-09-281-1/+1
| |\ \ | | |/ | |/|
| | * Closes issue #23600: Wrong results from tzinfo.fromutc().Alexander Belopolsky2015-09-281-1/+1
| | |
| * | Merge 3.4 (datetime rounding)Victor Stinner2015-09-181-11/+63
| |\ \ | | |/
| | * Issue #23517: Fix rounding in fromtimestamp() and utcfromtimestamp() methodsVictor Stinner2015-09-181-8/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of datetime.datetime: microseconds are now rounded to nearest with ties going to nearest even integer (ROUND_HALF_EVEN), instead of being rounding towards zero (ROUND_DOWN). It's important that these methods use the same rounding mode than datetime.timedelta to keep the property: (datetime(1970,1,1) + timedelta(seconds=t)) == datetime.utcfromtimestamp(t) It also the rounding mode used by round(float) for example. Add more unit tests on the rounding mode in test_datetime.
| * | Issue #25155: Add _PyTime_AsTimevalTime_t() functionVictor Stinner2015-09-181-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Windows, the tv_sec field of the timeval structure has the type C long, whereas it has the type C time_t on all other platforms. A C long has a size of 32 bits (signed inter, 1 bit for the sign, 31 bits for the value) which is not enough to store an Epoch timestamp after the year 2038. Add the _PyTime_AsTimevalTime_t() function written for datetime.datetime.now(): convert a _PyTime_t timestamp to a (secs, us) tuple where secs type is time_t. It allows to support dates after the year 2038 on Windows. Enhance also _PyTime_AsTimeval_impl() to detect overflow on the number of seconds when rounding the number of microseconds.
* | | Issue #25155: Add _PyTime_AsTimevalTime_t() functionVictor Stinner2015-09-181-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Windows, the tv_sec field of the timeval structure has the type C long, whereas it has the type C time_t on all other platforms. A C long has a size of 32 bits (signed inter, 1 bit for the sign, 31 bits for the value) which is not enough to store an Epoch timestamp after the year 2038. Add the _PyTime_AsTimevalTime_t() function written for datetime.datetime.now(): convert a _PyTime_t timestamp to a (secs, us) tuple where secs type is time_t. It allows to support dates after the year 2038 on Windows. Enhance also _PyTime_AsTimeval_impl() to detect overflow on the number of seconds when rounding the number of microseconds.
* | | Issue #23517: fromtimestamp() and utcfromtimestamp() methods ofVictor Stinner2015-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | datetime.datetime now round microseconds to nearest with ties going to nearest even integer (ROUND_HALF_EVEN), as round(float), instead of rounding towards -Infinity (ROUND_FLOOR). pytime API: replace _PyTime_ROUND_HALF_UP with _PyTime_ROUND_HALF_EVEN. Fix also _PyTime_Divide() for negative numbers. _PyTime_AsTimeval_impl() now reuses _PyTime_Divide() instead of reimplementing rounding modes.
* | | Revert change 0eb8c182131e:Victor Stinner2015-09-081-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | """Issue #23517: datetime.timedelta constructor now rounds microseconds to nearest with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python older than 3.3, instead of rounding to nearest with ties going to nearest even integer (ROUND_HALF_EVEN).""" datetime.timedelta uses rounding mode ROUND_HALF_EVEN again.
* | | Issue #22241: Fix a compiler waringVictor Stinner2015-09-071-1/+1
| | |
* | | Issue #15989: Fixed some scarcely probable integer overflows.Serhiy Storchaka2015-09-061-1/+1
| | | | | | | | | | | | It is very unlikely that they can occur in real code for now.
* | | Closes Issue#22241: timezone.utc name is now plain 'UTC', not 'UTC-00:00'.Alexander Belopolsky2015-09-061-0/+5
| | |
* | | Issue #23517: fromtimestamp() and utcfromtimestamp() methods ofVictor Stinner2015-09-031-1/+1
| | | | | | | | | | | | | | | | | | datetime.datetime now round microseconds to nearest with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python older than 3.3, instead of rounding towards -Infinity (ROUND_FLOOR).
* | | Issue #23517: datetime.timedelta constructor now rounds microseconds to nearestVictor Stinner2015-09-021-21/+1
| | | | | | | | | | | | | | | | | | with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python older than 3.3, instead of rounding to nearest with ties going to nearest even integer (ROUND_HALF_EVEN).
* | | Backed out changeset b690bf218702Victor Stinner2015-09-021-1/+1
| | | | | | | | | | | | | | | | | | Issue #23517: the change broke test_datetime. datetime.timedelta() rounding mode must also be changed, and test_datetime must be updated for the new rounding mode (half up).
* | | Issue #23517: datetime.datetime.fromtimestamp() andVictor Stinner2015-09-011-1/+1
| | | | | | | | | | | | | | | | | | datetime.datetime.utcfromtimestamp() now rounds to nearest with ties going away from zero, instead of rounding towards minus infinity (-inf), as Python 2 and Python older than 3.3.