cpython/Modules
Miss Islington (bot) 1699a5ee13
Check result of utc_to_seconds and skip fold probe in pure Python (GH-91582) (GH-92748)
The `utc_to_seconds` call can fail, here's a minimal reproducer on
Linux:

TZ=UTC python -c "from datetime import *; datetime.fromtimestamp(253402300799 + 1)"

The old behavior still raised an error in a similar way, but only
because subsequent calculations happened to fail as well. Better to fail
fast.

This also refactors the tests to split out the `fromtimestamp` and
`utcfromtimestamp` tests, and to get us closer to the actual desired
limits of the functions. As part of this, we also changed the way we
detect platforms where the same limits don't necessarily apply (e.g.
Windows).

As part of refactoring the tests to hit this condition explicitly (even
though the user-facing behvior doesn't change in any way we plan to
guarantee), I noticed that there was a difference in the places that
`datetime.utcfromtimestamp` fails in the C and pure Python versions, which
was fixed by skipping the "probe for fold" logic for UTC specifically —
since UTC doesn't have any folds or gaps, we were never going to find a
fold value anyway. This should prevent some failures in the pure python
`utcfromtimestamp` method on timestamps close to 0001-01-01.

There are two separate news entries for this because one is a
potentially user-facing change, the other is an internal code
correctness change that, if anything, changes some error messages. The
two happen to be coupled because of the test refactoring, but they are
probably best thought of as independent changes.

Fixes GH-91581
(cherry picked from commit 83c0247d47)

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2022-05-16 17:33:01 +02:00
..
_blake2 bpo-33164: blake2: Fix Coverity scan (GH-25060) 2021-03-29 21:36:39 -07:00
_ctypes [3.9] gh-91118: Fix docstrings that do not honor --without-doc-strings (GH-31769) (#91664) 2022-04-19 12:58:34 -07:00
_decimal bpo-44263: Fix _decimal and _testcapi GC protocol (GH-26464) 2021-05-31 04:33:31 -07:00
_io bpo-25415: Remove confusing sentence from IOBase docstrings (PR-31631) 2022-03-04 10:34:14 -08:00
_multiprocessing bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_sha3 [3.9] bpo-36515: Disable unaligned memory access in _sha3 on ARM (GH-25927) (GH-25928) 2021-05-06 08:55:35 +02:00
_sqlite [3.9] gh-80254: Disallow recursive usage of cursors in sqlite3 converters (#92278) 2022-05-05 12:47:58 -07:00
_ssl bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback (GH-24957) 2021-03-21 08:39:15 -07:00
_xxtestfuzz Fuzz struct.unpack and catch RecursionError in re.compile (GH-18679) 2020-02-27 23:05:02 -08:00
cjkcodecs bpo-40328: Add tool for generating cjk mapping headers (GH-19602) 2020-04-30 02:34:24 +09:00
clinic [3.9] gh-91583: AC: Fix regression for functions with defining_class (GH-91739) (GH-92080) 2022-05-03 11:54:06 +03:00
expat bpo-46932: Update bundled libexpat to 2.4.7 (GH-31736) 2022-03-07 14:18:24 -08:00
_abc.c bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for PyType_FromSpec types (reverts GH-19414) (GH-20264) 2020-05-28 08:12:23 -07:00
_asynciomodule.c [3.9] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (GH-30785) 2022-01-22 04:52:24 -08:00
_bisectmodule.c bpo-40665: Use Argument Clinic for the bisect module (GH-20163) 2020-05-17 20:38:35 -07:00
_bz2module.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_codecsmodule.c bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" codec (GH-28944) (GH-28953) 2021-10-14 21:23:52 +03:00
_collectionsmodule.c bpo-41621: Document defaultdict's default_factory parameter (GH-21945) 2021-06-22 07:42:41 -07:00
_contextvarsmodule.c bpo-1635741: Port _contextvars module to multiphase initialization (PEP 489) (GH-18374) 2020-02-17 14:49:26 +01:00
_cryptmodule.c closes bpo-44751: Move crypt.h include from public header to _cryptmodule (GH-27394) 2021-09-29 13:47:58 -07:00
_csv.c [3.9] bpo-20028: Keep original exception when PyUnicode_GetLength return -1 (GH-28832) (GH-28835) 2021-10-10 01:13:44 +09:00
_curses_panel.c [3.9] bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (GH-21933). (GH-24403) 2021-01-31 21:44:31 +02:00
_cursesmodule.c bpo-46000: Improve NetBSD curses compatibility (GH-29947) (GH-30023) 2021-12-10 13:21:19 +02:00
_datetimemodule.c Check result of utc_to_seconds and skip fold probe in pure Python (GH-91582) (GH-92748) 2022-05-16 17:33:01 +02:00
_dbmmodule.c bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521) 2020-02-17 11:09:15 +01:00
_elementtree.c [3.9] bpo-45948: Remove constructor discrepancy in C version of ElementTree.XMLParser (GH-31152) (GH-31299) 2022-02-13 02:16:31 +02:00
_functoolsmodule.c bpo-42536: GC track recycled tuples (GH-23623) (GH-23651) 2020-12-07 20:07:48 +00:00
_gdbmmodule.c [3.9] bpo-45060: Get rid of few uses of the equality operators with None (GH-28087). (GH-28093) 2021-09-01 09:51:01 +03:00
_hashopenssl.c bpo-47101: list only activated algorithms in hashlib.algorithms_available (GH-32076) 2022-03-23 13:58:02 -07:00
_heapqmodule.c bpo-1635741: Port _heapq module to multiphase initialization (GH19057) 2020-03-18 15:29:34 +01:00
_json.c bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for PyType_FromSpec types (reverts GH-19414) (GH-20264) 2020-05-28 08:12:23 -07:00
_localemodule.c bpo-38324: Fix test__locale.py Windows failures (GH-20529) 2020-10-20 05:07:14 -07:00
_lsprof.c bpo-40429: PyFrame_GetCode() now returns a strong reference (GH-19773) 2020-04-29 01:28:13 +02:00
_lzmamodule.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_math.c [3.9] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28512) 2021-09-22 17:32:04 +02:00
_math.h
_opcode.c bpo-32455: Add jump parameter to dis.stack_effect(). (GH-6610) 2018-09-18 09:54:26 +03:00
_operator.c [3.9] bpo-44558: Match countOf is/== treatment to c (GH-27007). (GH-27055) 2021-07-07 23:55:22 +09:00
_peg_parser.c Refactor scripts in Tools/peg_generator/scripts (GH-20401) 2020-06-05 21:41:12 -07:00
_pickle.c [3.9] Fix typos in the Modules directory (GH-28761). (GH-28791) 2021-10-07 06:17:05 -07:00
_posixsubprocess.c bpo-42655: Fix subprocess extra_groups gid conversion (GH-23762) 2020-12-29 05:22:13 -08:00
_queuemodule.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_randommodule.c [3.9] bpo-41052: Fix pickling heap types implemented in C with protocols 0 and 1 (GH-22870). (GH-22963) 2020-10-25 17:56:17 +02:00
_scproxy.c closes bpo-31903: Release the GIL when calling into SystemConfiguration (GH-4178) 2018-09-11 16:14:00 -07:00
_sre.c bpo-23691: Protect the re.finditer() iterator from re-entering (GH-32012) 2022-03-21 04:28:31 -07:00
_ssl.c Fix typo in a comment in Modules/_ssl.c: s/validata/validate/ (GH-27993) (GH-27998) 2021-08-27 13:59:23 +02:00
_ssl_data.h closes bpo-40266, closes bpo-39953: Use numeric lib code if compiling against old OpenSSL. (GH-19506) 2020-04-13 22:11:40 -05:00
_ssl_data_111.h [3.9] bpo-43788: Generate version specific _ssl_data.h (GH-25300) (GH-25310) 2021-04-09 18:34:39 +02:00
_ssl_data_300.h [3.9] bpo-43788: Generate version specific _ssl_data.h (GH-25300) (GH-25310) 2021-04-09 18:34:39 +02:00
_stat.c bpo-40677: Define IO_REPARSE_TAG_APPEXECLINK explicitly (GH-20206) 2020-05-19 05:40:21 -07:00
_statisticsmodule.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_struct.c bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for PyType_FromSpec types (reverts GH-19414) (GH-20264) 2020-05-28 08:12:23 -07:00
_testbuffer.c closes bpo-39736: const strings in Modules/_datetimemodule.c and Modules/_testbuffer.c (GH-18637) 2020-02-23 22:40:43 -08:00
_testcapimodule.c [3.9] gh-91118: Fix docstrings that do not honor --without-doc-strings (GH-31769) (#91664) 2022-04-19 12:58:34 -07:00
_testimportmultiple.c
_testinternalcapi.c bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297) 2020-07-06 09:52:13 -07:00
_testmultiphase.c [3.9] bpo-44050: Extension modules can share state when they don't support sub-interpreters. (GH-27794) (GH-28741) 2021-10-05 22:30:25 +02:00
_threadmodule.c bpo-44434: Don't call PyThread_exit_thread() explicitly (GH-26758) (GH-26825) 2021-06-21 14:22:56 +02:00
_tkinter.c [3.9] Fix typos in the Modules directory (GH-28761). (GH-28791) 2021-10-07 06:17:05 -07:00
_tracemalloc.c bpo-46280: Fix tracemalloc_copy_domain() (GH-30591) 2022-01-13 20:35:21 -08:00
_uuidmodule.c bpo-40501: Replace ctypes code in uuid with native module (GH-19948) 2020-05-12 23:32:32 +01:00
_weakref.c bpo-40170: PyObject_GET_WEAKREFS_LISTPTR() becomes a function (GH-19377) 2020-04-06 14:07:02 +02:00
_winapi.c [3.9] Update URLs in comments and metadata to use HTTPS (GH-27458) (GH-27480) 2021-07-30 16:34:04 +02:00
_xxsubinterpretersmodule.c bpo-43472: Ensure PyInterpreterState_New audit events are raised when called through _xxsubinterpreters module (GH-25506) (GH-25508) 2021-04-28 18:20:40 +02:00
_zoneinfo.c [3.9] bpo-46383: Fix signature of zoneinfo module_free function (GH-3… (GH-30611) 2022-01-22 03:05:55 -08:00
addrinfo.h
arraymodule.c [3.9] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28512) 2021-09-22 17:32:04 +02:00
atexitmodule.c bpo-39824: module_traverse() don't call m_traverse if md_state=NULL (GH-18738) 2020-03-17 18:09:46 +01:00
audioop.c [3.9] bpo-46513: Remove AC_C_CHAR_UNSIGNED / __CHAR_UNSIGNED__ (GH-30851) (GH-30915) 2022-01-26 12:20:39 +01:00
binascii.c bpo-38256: Fix binascii.crc32 large input. (GH-32000) (GH-32013) (GH-32015) 2022-03-20 23:34:45 -07:00
cmathmodule.c bpo-35081: Move dtoa.h header to the internal C API (GH-18489) 2020-02-12 22:54:42 +01:00
config.c.in rename _imp initialization function to follow conventions (#5432) 2018-01-29 11:33:57 -08:00
errnomodule.c bpo-1635741: Port errno module to multiphase initialization (GH-19923) 2020-05-07 10:17:16 +09:00
faulthandler.c [3.9] bpo-46968: Check for 'sys/auxv.h' in the configure script (GH-31961). (GH-31975) 2022-03-18 13:33:03 +00:00
fcntlmodule.c bpo-39184: Add audit events to functions in fcntl, msvcrt, os, resource, shutil, signal, syslog (GH-18407) 2020-02-13 07:47:42 +00:00
gc_weakref.txt [3.9] Fix typos in the Modules directory (GH-28761). (GH-28791) 2021-10-07 06:17:05 -07:00
gcmodule.c gh-92036: Fix gc_fini_untrack() (GH-92037) 2022-05-04 03:25:33 -07:00
getaddrinfo.c bpo-32241: Add the const qualifire to declarations of umodifiable strings. (#4748) 2017-12-12 13:55:04 +02:00
getbuildinfo.c bpo-45532: Replace 'default' with 'main' as default in sys.version (GH-29100) 2021-10-20 10:45:06 -07:00
getnameinfo.c
getpath.c [3.9] Fix typos in the Modules directory (GH-28761). (GH-28791) 2021-10-07 06:17:05 -07:00
grpmodule.c bpo-39968: Convert extension modules' macros of get_module_state() to inline functions (GH-19017) 2020-03-16 14:15:01 +01:00
hashlib.h [3.9] hashlib: Fix old message about unicode objects. (GH-28653) (GH-28679) 2021-10-01 06:28:19 -07:00
itertoolsmodule.c [3.9] bpo-46728: fix docstring of combinations_with_replacement for consistency (GH-31293). (GH-31356) 2022-02-15 21:22:01 +09:00
ld_so_aix.in
main.c [3.9] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (GH-21956) (#22397) 2020-09-24 16:34:21 +02:00
makesetup bpo-45571: use PY_CFLAGS_NODIST for shared Modules/Setup (GH-29161) 2021-10-22 11:29:52 -07:00
makexp_aix
mathmodule.c bpo-46018: Ensure that math.expm1 does not raise on underflow (GH-29997) 2021-12-09 10:55:53 -08:00
md5module.c bpo-43204: Fix LibTomCrypt URL in md5module.c and sha*module.c comments (GH-24507) 2021-02-12 03:18:38 -08:00
mmapmodule.c bpo-39481: remove generic classes from ipaddress/mmap (GH-20045) 2020-05-11 19:32:40 -07:00
nismodule.c bpo-35356: Fix a possible reference leak in nis.maps(). (GH-10808) 2018-11-30 09:40:16 +02:00
ossaudiodev.c gh-91734: Fix ossaudio support on Solaris (GH-91735) 2022-04-20 04:09:01 -07:00
overlapped.c bpo-40150: Fix mismatched argument in RegisterWaitForSingleObject() call (GH-19686) 2020-07-15 12:25:59 -07:00
parsermodule.c bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521) 2020-02-17 11:09:15 +01:00
posixmodule.c bpo-46785: Fix race condition between os.stat() and unlink on Windows (GH-31858) 2022-05-09 23:42:59 +01:00
posixmodule.h [3.9] bpo-41498: Fix build on platforms without sigset_t (GH-29770) (GH-29774) 2021-11-25 13:02:54 +01:00
pwdmodule.c bpo-39968: Convert extension modules' macros of get_module_state() to inline functions (GH-19017) 2020-03-16 14:15:01 +01:00
pyexpat.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
readline.c bpo-42819, readline: Disable bracketed paste (GH-24108) (GH-24545) 2021-02-16 01:18:07 +01:00
README
resource.c bpo-1635741: Port resource extension module to multiphase initialization (PEP 489) (GH-19252) 2020-04-02 14:35:08 +02:00
rotatingtree.c
rotatingtree.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
selectmodule.c [3.9] bpo-41857: mention timeout argument units in select.poll() and select.depoll() doc-strings (GH-22406) 2022-01-21 11:37:39 +02:00
Setup bpo-40503: PEP 615: Tests and implementation for zoneinfo (GH-19909) 2020-05-16 10:20:06 +02:00
sha1module.c [3.9] Fix typos in the Modules directory (GH-28761). (GH-28791) 2021-10-07 06:17:05 -07:00
sha256module.c bpo-43204: Fix LibTomCrypt URL in md5module.c and sha*module.c comments (GH-24507) 2021-02-12 03:18:38 -08:00
sha512module.c bpo-43204: Fix LibTomCrypt URL in md5module.c and sha*module.c comments (GH-24507) 2021-02-12 03:18:38 -08:00
signalmodule.c [3.9] bpo-41498: Fix build on platforms without sigset_t (GH-29770) (GH-29774) 2021-11-25 13:02:54 +01:00
socketmodule.c [3.9] bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866) (GH-32140) (GH-32156) 2022-03-28 13:03:18 -07:00
socketmodule.h bpo-40291: Add support for CAN_J1939 sockets (GH-19538) 2020-04-29 15:31:19 -07:00
spwdmodule.c
sre.h bpo-23691: Protect the re.finditer() iterator from re-entering (GH-32012) 2022-03-21 04:28:31 -07:00
sre_constants.h
sre_lib.h bpo-39943: Fix MSVC warnings in sre extension (GH-20508) 2021-03-14 05:17:26 -07:00
symtablemodule.c bpo-37253: Add _PyCompilerFlags_INIT macro (GH-14018) 2019-06-13 02:16:41 +02:00
syslogmodule.c [3.9] Fix typos in the Modules directory (GH-28761). (GH-28791) 2021-10-07 06:17:05 -07:00
termios.c bpo-39968: Convert extension modules' macros of get_module_state() to inline functions (GH-19017) 2020-03-16 14:15:01 +01:00
testcapi_long.h
timemodule.c [3.9] Remove trailing spaces (GH-28710) 2021-10-03 20:04:38 +03:00
tkappinit.c
tkinter.h
unicodedata.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
unicodedata_db.h closes bpo-39926: Update Unicode to 13.0.0. (GH-18910) 2020-03-10 20:41:34 -07:00
unicodename_db.h closes bpo-39926: Update Unicode to 13.0.0. (GH-18910) 2020-03-10 20:41:34 -07:00
winreparse.h bpo-31512: Add non-elevated symlink support for Windows (GH-3652) 2019-04-09 11:19:46 -07:00
xxlimited.c bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for PyType_FromSpec types (reverts GH-19414) (GH-20264) 2020-05-28 08:12:23 -07:00
xxmodule.c bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521) 2020-02-17 11:09:15 +01:00
xxsubtype.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
zlibmodule.c [3.9] bpo-41735: Fix thread lock in zlib.Decompress.flush() may go wrong (GH-29588) 2021-11-26 16:21:22 -08:00

Source files for standard library extension modules,
and former extension modules that are now builtin modules.