Staging
v0.5.1
https://github.com/python/cpython
Revision 1b97b9b0ad9a2ff8eb5c8f2e2e7c2aec1d13a330 authored by Paul Ganssle on 16 May 2020, 14:02:59 UTC, committed by GitHub on 16 May 2020, 14:02:59 UTC
{date, datetime}.isocalendar() now return a private custom named tuple object
IsoCalendarDate rather than a simple tuple.

In order to leave IsocalendarDate as a private class and to improve what
backwards compatibility is offered for pickling the result of a
datetime.isocalendar() call, add a __reduce__ method to the named tuples that
reduces them to plain tuples. (This is the part of this PR most likely to cause
problems — if it causes major issues, switching to a strucseq or equivalent
would be prudent).

The pure python implementation of IsoCalendarDate uses positional-only
arguments, since it is private and only constructed by position anyway; the
equivalent change in the argument clinic on the C side would require us to move
the forward declaration of the type above the clinic import for whatever
reason, so it seems preferable to hold off on that for now.

bpo-24416: https://bugs.python.org/issue24416

Original PR by Dong-hee Na with only minor alterations by Paul Ganssle.

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
1 parent aa92a7c
History
Tip revision: 1b97b9b0ad9a2ff8eb5c8f2e2e7c2aec1d13a330 authored by Paul Ganssle on 16 May 2020, 14:02:59 UTC
bpo-24416: Return named tuple from date.isocalendar() (GH-20113)
Tip revision: 1b97b9b
File Mode Size
.azure-pipelines
.github
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Programs
Python
Tools
m4
.gitattributes -rw-r--r-- 1.8 KB
.gitignore -rw-r--r-- 1.8 KB
.travis.yml -rw-r--r-- 8.3 KB
CODE_OF_CONDUCT.md -rw-r--r-- 630 bytes
LICENSE -rw-r--r-- 12.5 KB
Makefile.pre.in -rw-r--r-- 68.5 KB
README.rst -rw-r--r-- 9.9 KB
aclocal.m4 -rw-r--r-- 13.1 KB
config.guess -rwxr-xr-x 43.1 KB
config.sub -rwxr-xr-x 35.4 KB
configure -rwxr-xr-x 500.1 KB
configure.ac -rw-r--r-- 168.9 KB
install-sh -rwxr-xr-x 15.0 KB
netlify.toml -rw-r--r-- 82 bytes
pyconfig.h.in -rw-r--r-- 44.5 KB
setup.py -rw-r--r-- 105.1 KB

README.rst

back to top