summaryrefslogtreecommitdiffstats
path: root/Modules/_datetimemodule.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-32746: Fix multiple typos (GH-5144)Leo Arias2018-02-041-1/+1
| | | Fix typos found by codespell in docs, docstrings, and comments.
* bpo-10381: Add timezone to datetime C API (#5032)Paul Ganssle2018-01-241-0/+3
| | | | | | | | | | | | | | | | | | * Add timezone to datetime C API * Add documentation for timezone C API macros * Add dedicated tests for datetime type check macros * Remove superfluous C API test * Drop support for TimeZoneType in datetime C API * Expose UTC singleton to the datetime C API * Update datetime C-API documentation to include links * Add reference count information for timezone constructors
* bpo-32403: Faster date and datetime constructors (#4993)Paul Ganssle2018-01-161-45/+75
| | | | | | | | | | | | | | * Add tests for date subclass alternate constructors * Switch over alternate date constructors to fast path * Switch datetime constructors to fastpath, fix bpo-32404 * Add fast path for datetime in date subclass constructor * Set fold in constructor in datetime.combine * Add news entries.
* bpo-29240: Fix locale encodings in UTF-8 Mode (#5170)Victor Stinner2018-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Modify locale.localeconv(), time.tzname, os.strerror() and other functions to ignore the UTF-8 Mode: always use the current locale encoding. Changes: * Add _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx(). On decoding or encoding error, they return the position of the error and an error message which are used to raise Unicode errors in PyUnicode_DecodeLocale() and PyUnicode_EncodeLocale(). * Replace _Py_DecodeCurrentLocale() with _Py_DecodeLocaleEx(). * PyUnicode_DecodeLocale() now uses _Py_DecodeLocaleEx() for all cases, especially for the strict error handler. * Add _Py_DecodeUTF8Ex(): return more information on decoding error and supports the strict error handler. * Rename _Py_EncodeUTF8_surrogateescape() to _Py_EncodeUTF8Ex(). * Replace _Py_EncodeCurrentLocale() with _Py_EncodeLocaleEx(). * Ignore the UTF-8 mode to encode/decode localeconv(), strerror() and time zone name. * Remove PyUnicode_DecodeLocale(), PyUnicode_DecodeLocaleAndSize() and PyUnicode_EncodeLocale() now ignore the UTF-8 mode: always use the "current" locale. * Remove _PyUnicode_DecodeCurrentLocale(), _PyUnicode_DecodeCurrentLocaleAndSize() and _PyUnicode_EncodeCurrentLocale().
* bpo-15873: Implement [date][time].fromisoformat (#4699)Paul Ganssle2017-12-211-0/+353
| | | Closes bpo-15873.
* bpo-23699: Use a macro to reduce boilerplate code in rich comparison ↵stratakis2017-11-021-16/+1
| | | | functions (GH-793)
* bpo-31752: Fix possible crash in timedelta constructor called with custom ↵Serhiy Storchaka2017-10-231-2/+7
| | | | | integers. (#3947) Bad remainder in divmod() in intermediate calculations caused an assertion failure.
* Refactor multiplication and division of timedelta and float. (#3656)Serhiy Storchaka2017-10-041-41/+10
| | | Implementations of these operations are virtually identical.
* bpo-31293: Fix crashes in truediv and mul of a timedelta by a float with a ↵Oren Milman2017-09-191-4/+33
| | | | bad as_integer_ratio() method. (#3227)
* bpo-31338 (#3374)Barry Warsaw2017-09-151-2/+1
| | | | | | | * Add Py_UNREACHABLE() as an alias to abort(). * Use Py_UNREACHABLE() instead of assert(0) * Convert more unreachable code to use Py_UNREACHABLE() * Document Py_UNREACHABLE() and a few other macros.
* Closes issue bpo-5288: Allow tzinfo objects with sub-minute offsets. (#2896)Alexander Belopolsky2017-07-311-27/+30
| | | | | | | | | | | | | | | | | | * Closes issue bpo-5288: Allow tzinfo objects with sub-minute offsets. * bpo-5288: Implemented %z formatting of sub-minute offsets. * bpo-5288: Removed mentions of the whole minute limitation on TZ offsets. * bpo-5288: Removed one more mention of the whole minute limitation. Thanks @csabella! * Fix a formatting error in the docs * Addressed review comments. Thanks, @haypo.
* bpo-30302 Make timedelta.__repr__ more informative. (#1493)Utkarsh Upadhyay2017-07-251-15/+44
|
* bpo-29953: Fix memory leaks in the replace() method of datetime and time (#927)Serhiy Storchaka2017-03-311-11/+10
| | | objects when pass out of bound fold argument.
* bpo-29878: Add global instances of int for 0 and 1. (#852)Serhiy Storchaka2017-03-301-5/+3
|
* Merge 3.6Victor Stinner2017-02-101-21/+40
|\
| * 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.
* | Merge 3.6Victor Stinner2017-01-031-5/+5
|\ \ | |/
| * 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 #28959: Added private macro PyDict_GET_SIZE for retrieving the size of ↵Serhiy Storchaka2016-12-161-1/+1
| | | | | | | | dict.
* | Use _PyObject_CallMethodIdObjArgs() in _datetimeVictor Stinner2016-12-091-8/+11
| | | | | | | | | | | | | | | | | | Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() when the format string was only made of "O" formats, PyObject* arguments. _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string.
* | Fix refleak introduced in change 032cbdb596feVictor Stinner2016-12-091-0/+1
| | | | | | | | Issue #28915.
* | build_struct_time() uses Py_BuildValue()Victor Stinner2016-12-081-11/+20
| | | | | | | | | | | | Issue #28915: Avoid calling _PyObject_CallMethodId() with "(...)" format to avoid the creation of a temporary tuple: use Py_BuildValue() with _PyObject_CallMethodIdObjArgs().
* | Don't parenthesis in _PyObject_CallMethodId() formatVictor Stinner2016-12-081-1/+1
| | | | | | | | | | Issue #28915: Without parenthesis, _PyObject_CallMethodId() avoids the creation a temporary tuple, and so is more efficient.
* | Issue #28752: Restored the __reduce__() methods of datetime objects.Serhiy Storchaka2016-11-211-8/+26
|\ \ | |/
| * 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.
| * Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSizeSerhiy Storchaka2016-11-201-2/+2
| | | | | | | | with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
* | Issue #28511: Use the "U" format instead of "O!" in PyArg_Parse*.Serhiy Storchaka2016-10-231-3/+2
|/
* 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
| |