cpython/Modules
Paul Ganssle 62972d9d73
bpo-40503: PEP 615: Tests and implementation for zoneinfo (GH-19909)
This is the initial implementation of PEP 615, the zoneinfo module,
ported from the standalone reference implementation (see
https://www.python.org/dev/peps/pep-0615/#reference-implementation for a
link, which has a more detailed commit history).

This includes (hopefully) all functional elements described in the PEP,
but documentation is found in a separate PR. This includes:

1. A pure python implementation of the ZoneInfo class
2. A C accelerated implementation of the ZoneInfo class
3. Tests with 100% branch coverage for the Python code (though C code
   coverage is less than 100%).
4. A compile-time configuration option on Linux (though not on Windows)

Differences from the reference implementation:

- The module is arranged slightly differently: the accelerated module is
  `_zoneinfo` rather than `zoneinfo._czoneinfo`, which also necessitates
  some changes in the test support function. (Suggested by Victor
  Stinner and Steve Dower.)
- The tests are arranged slightly differently and do not include the
  property tests. The tests live at test/test_zoneinfo/test_zoneinfo.py
  rather than test/test_zoneinfo.py or test/test_zoneinfo/__init__.py
  because we may do some refactoring in the future that would likely
  require this separation anyway; we may:
        - include the property tests
        - automatically run all the tests against both pure Python and C,
          rather than manually constructing C and Python test classes (similar
          to the way this works with test_datetime.py, which generates C
          and Python test cases from datetimetester.py).
- This includes a compile-time configuration option on Linux (though not
  on Windows); added with much help from Thomas Wouters.
- Integration into the CPython build system is obviously different from
  building a standalone zoneinfo module wheel.
- This includes configuration to install the tzdata package as part of
  CI, though only on the coverage jobs. Introducing a PyPI dependency as
  part of the CI build was controversial, and this is seen as less of a
  major change, since the coverage jobs already depend on pip and PyPI.

Additional changes that were introduced as part of this PR, most / all of
which were backported to the reference implementation:

- Fixed reference and memory leaks

    With much debugging help from Pablo Galindo

- Added smoke tests ensuring that the C and Python modules are built

    The import machinery can be somewhat fragile, and the "seamlessly falls
    back to pure Python" nature of this module makes it so that a problem
    building the C extension or a failure to import the pure Python version
    might easily go unnoticed.

- Adjustments to zoneinfo.__dir__

    Suggested by Petr Viktorin.

- Slight refactorings as suggested by Steve Dower.

- Removed unnecessary if check on std_abbr

    Discovered this because of a missing line in branch coverage.
2020-05-16 10:20:06 +02:00
..
_blake2 bpo-40268: Remove explicit pythread.h includes (#19529) 2020-04-15 02:04:42 +02:00
_ctypes bpo-40302: Add pycore_byteswap.h header file (GH-19552) 2020-04-17 17:47:20 +02:00
_decimal bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_io bpo-40521: Add PyInterpreterState.unicode (GH-20081) 2020-05-14 01:48:38 +02:00
_multiprocessing bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_sha3 bpo-40302: Replace PY_INT64_T with int64_t (GH-19573) 2020-04-17 19:13:06 +02:00
_sqlite bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_ssl bpo-34271: Fix compatibility with 1.0.2 (GH-13728) 2019-06-03 20:40:15 +02: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 bpo-31033: Add a msg argument to Future.cancel() and Task.cancel() (GH-19979) 2020-05-15 16:55:50 -07:00
expat bpo-37731: Reorder includes in xmltok.c to avoid redefinition of _POSIX_C_SOURCE (GH-16733) 2019-10-12 20:14:11 +01:00
_abc.c bpo-40566: Apply PEP 573 to abc module (GH-20005) 2020-05-09 01:31:40 -07:00
_asynciomodule.c bpo-31033: Add a msg argument to Future.cancel() and Task.cancel() (GH-19979) 2020-05-15 16:55:50 -07:00
_bisectmodule.c bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749) 2018-11-27 13:27:31 +02:00
_bz2module.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_codecsmodule.c bpo-1635741: Port _codecs extension module to multiphase initialization (PEP 489) (GH-18065) 2020-02-11 03:16:38 -08:00
_collectionsmodule.c bpo-40277: Add a repr() to namedtuple's _tuplegetter to aid with introspection (GH-19537) 2020-04-14 23:36:08 -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 bpo-1635741: Port _crypt extension module to multiphase initialization (PEP 489) (GH-18404) 2020-02-17 10:11:34 +01:00
_csv.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_curses_panel.c bpo-40170: PyObject_NEW() becomes an alias to PyObject_New() (GH-19379) 2020-04-08 00:38:15 +02:00
_cursesmodule.c bpo-39465: Don't access directly _Py_Identifier members (GH-20043) 2020-05-12 01:43:38 +02:00
_datetimemodule.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +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 bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_functoolsmodule.c bpo-40504: Allow weakrefs to lru_cache objects (GH-19938) 2020-05-05 14:14:32 -07:00
_gdbmmodule.c bpo-32494: Use gdbm_count for dbm_length if possible (GH-19814) 2020-05-01 14:15:35 +02:00
_hashopenssl.c bpo-40515: Require OPENSSL_THREADS (GH-19953) 2020-05-15 11:55:25 -07:00
_heapqmodule.c bpo-1635741: Port _heapq module to multiphase initialization (GH19057) 2020-03-18 15:29:34 +01:00
_json.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_localemodule.c bpo-39943: Add the const qualifier to pointers on non-mutable PyBytes data. (GH-19472) 2020-04-12 14:58:27 +03: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 Issue #28256: Cleanup _math.c 2016-10-18 16:29:27 +02:00
_math.h Issue #28256: Cleanup _math.c 2016-10-18 16:29:27 +02:00
_opcode.c bpo-32455: Add jump parameter to dis.stack_effect(). (GH-6610) 2018-09-18 09:54:26 +03:00
_operator.c bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode data. (GH-19345) 2020-04-11 10:48:40 +03:00
_peg_parser.c bpo-40334: Make the PyPegen* and PyParser* APIs more consistent (GH-19839) 2020-05-01 18:30:51 +01:00
_pickle.c bpo-39435: Make the first argument of pickle.loads() positional-only. (GH-19846) 2020-05-02 09:38:01 +03:00
_posixsubprocess.c bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820) 2020-05-01 11:33:44 +02:00
_queuemodule.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_randommodule.c bpo-40286: Remove C implementation of Random.randbytes() (GH-19797) 2020-04-29 18:49:00 +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-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_ssl.c bpo-40457: Support OpenSSL without TLS 1.0/1.1 (GH-19862) 2020-05-15 18:33:05 -07: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
_stat.c bpo-1635741: Fix compiler warning in _stat.c (GH-19822) 2020-05-01 00:44:03 +02:00
_statisticsmodule.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
_struct.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02: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 bpo-39849: Enable assertions in _testcapimodule.c and _testinternalcapi.c (GH-19623) 2020-04-21 01:49:13 +09:00
_testimportmultiple.c
_testinternalcapi.c bpo-40602: _Py_hashtable_set() reports rehash failure (GH-20077) 2020-05-14 22:44:32 +02:00
_testmultiphase.c bpo-38787: Update structures.rst docs (PEP 573) (GH-19980) 2020-05-07 19:16:01 +02:00
_threadmodule.c bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820) 2020-05-01 11:33:44 +02:00
_tkinter.c Trivial typo fix in _tkinter.c (GH-19622) 2020-05-15 03:43:58 -07:00
_tracemalloc.c bpo-40609: _Py_hashtable_t values become void* (GH-20065) 2020-05-13 04:40:30 +02: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 bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820) 2020-05-01 11:33:44 +02:00
_xxsubinterpretersmodule.c Revert "bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)" (GH-20089) 2020-05-14 18:46:24 +02:00
_zoneinfo.c bpo-40503: PEP 615: Tests and implementation for zoneinfo (GH-19909) 2020-05-16 10:20:06 +02:00
addrinfo.h replace PY_LONG_LONG with long long 2016-09-06 10:46:49 -07:00
arraymodule.c bpo-36346: array: Don't use deprecated APIs (GH-19653) 2020-05-11 15:37:25 +09: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 bpo-39824: Convert PyModule_GetState() to get_module_state() (GH-19076) 2020-03-19 10:11:33 -07:00
binascii.c Use calloc-based functions, not malloc. (GH-19152) 2020-03-24 23:26:44 -05: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 bpo-40268: Remove explicit pythread.h includes (#19529) 2020-04-15 02:04:42 +02: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
gcmodule.c bpo-40533: Disable GC in subinterpreters (GH-19961) 2020-05-06 18:25:06 +02: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-27593: Get SCM build info from git instead of hg. (#446) 2017-03-04 00:19:55 -05:00
getnameinfo.c
getpath.c bpo-40268: Remove unused osdefs.h includes (GH-19532) 2020-04-15 03:24:57 +02: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 bpo-31370: Remove support for threads-less builds (#3385) 2017-09-07 18:56:24 +02:00
itertoolsmodule.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
ld_so_aix.in Issue #10656: Fix out-of-tree building on AIX 2016-11-20 07:56:37 +00:00
main.c bpo-40268: Remove unused imports in pylifecycle.c (GH-19533) 2020-04-15 04:01:58 +02:00
makesetup closes bpo-34212: Build core extension modules with Py_BUILD_CORE_BUILTIN. (GH-8712) 2018-11-26 20:21:31 -06:00
makexp_aix
mathmodule.c bpo-1635741: Port math module to multiphase initialization (GH-19243) 2020-03-31 16:33:22 +02:00
md5module.c closes bpo-39621: Make buf arg to md5_compress be const. (GH-18497) 2020-02-12 20:53:01 -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 bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
overlapped.c bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02: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-40549: posixmodule.c uses defining_class (GH-20075) 2020-05-14 18:05:58 +02:00
posixmodule.h bpo-33441: Make the sigset_t converter available in other modules. (GH-6720) 2018-05-08 07:48:50 +03: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-39943: Add the const qualifier to pointers on non-mutable PyBytes data. (GH-19472) 2020-04-12 14:58:27 +03: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 bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00
Setup bpo-40503: PEP 615: Tests and implementation for zoneinfo (GH-19909) 2020-05-16 10:20:06 +02:00
sha1module.c bpo-39573: Add Py_SET_TYPE() function (GH-18394) 2020-02-07 09:17:07 +01:00
sha256module.c bpo-40302: Add pycore_byteswap.h header file (GH-19552) 2020-04-17 17:47:20 +02:00
sha512module.c bpo-40302: Add pycore_byteswap.h header file (GH-19552) 2020-04-17 17:47:20 +02:00
signalmodule.c bpo-40268: Remove explicit pythread.h includes (#19529) 2020-04-15 02:04:42 +02:00
socketmodule.c bpo-40291: Add support for CAN_J1939 sockets (GH-19538) 2020-04-29 15:31:19 -07:00
socketmodule.h bpo-40291: Add support for CAN_J1939 sockets (GH-19538) 2020-04-29 15:31:19 -07:00
spwdmodule.c [security] bpo-13617: Reject embedded null characters in wchar* strings. (#2302) 2017-06-28 08:30:06 +03:00
sre.h bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode data. (GH-19345) 2020-04-11 10:48:40 +03:00
sre_constants.h bpo-31690: Allow the inline flags "a", "L", and "u" to be used as group flags for RE. (#3885) 2017-10-24 23:31:42 +03:00
sre_lib.h bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode data. (GH-19345) 2020-04-11 10:48:40 +03:00
symtablemodule.c bpo-37253: Add _PyCompilerFlags_INIT macro (GH-14018) 2019-06-13 02:16:41 +02:00
syslogmodule.c bpo-1635741: Port syslog module to multiphase initialization (GH-19907) 2020-05-05 10:49:46 +09: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 bpo-40268: Remove explicit pythread.h includes (#19529) 2020-04-15 02:04:42 +02: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-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521) 2020-02-17 11:09:15 +01: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 bpo-40268: Remove unused structmember.h includes (GH-19530) 2020-04-15 02:35:41 +02:00

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