Commit Graph

16 Commits

Author SHA1 Message Date
Miss Islington (bot) 57efb77fef
[3.13] Update HTTP links in the _pydatetime docstrings (GH-133025) (GH-133782)
(cherry picked from commit aed28eb5a0)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-09 19:02:41 +00:00
Victor Stinner 27fd328cf6
[3.13] gh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()` (#130962) (#131076)
gh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()` (#130962)

Fix the pure Python implementation of `fromisoformat()` to reject any
non-digit characters, including whitespace, in the fractional part
of time specification.  This makes the behavior consistent with the C
implementation, and prevents incorrect parsing of these fractions
(e.g. `.400 ` would be misinterpreted as `.04`).

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
(cherry picked from commit 33494b4d0d)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
2025-03-11 12:39:27 +01:00
Miss Islington (bot) b2bacbbea3
[3.13] gh-127553: Remove outdated TODO comment in _pydatetime (GH-127564) (#128500)
(cherry picked from commit e8b6b39ff7)

Co-authored-by: Beomsoo Kim <beoms424@gmail.com>
2025-01-04 23:01:03 +00:00
Serhiy Storchaka 9f6f8790ef
Revert "[3.13] gh-120713: Normalize year with century for datetime.strftime (GH-120820) (GH-121144)" (GH-122408)
This reverts commit 009618f112.
2024-07-29 21:55:28 +03:00
Miss Islington (bot) 009618f112
[3.13] gh-120713: Normalize year with century for datetime.strftime (GH-120820) (GH-121144)
(cherry picked from commit 6d34938dc8)

Co-authored-by: blhsing <blhsing@gmail.com>
2024-06-29 06:57:33 +00:00
Miss Islington (bot) 64a61ca13c
[3.13] gh-120268: Prohibit passing ``None`` to ``_pydatetime.date.fromtimestamp`` (GH-120269) (GH-120282)
This makes the pure Python implementation consistent with the C implementation.
(cherry picked from commit 34f5ae69fe)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-06-11 12:54:02 +03:00
Serhiy Storchaka b104360788
gh-49766: Make date-datetime comparison more symmetric and flexible (GH-114760)
Now the special comparison methods like `__eq__` and `__lt__` return
NotImplemented if one of comparands is date and other is datetime
instead of ignoring the time part and the time zone or forcefully
return "not equal" or raise TypeError.

It makes comparison of date and datetime subclasses more symmetric
and allows to change the default behavior by overriding
the special comparison methods in subclasses.

It is now the same as if date and datetime was independent classes.
2024-02-11 13:06:43 +02:00
Serhiy Storchaka dc4cd2c9ba
gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761) 2024-01-30 22:15:33 +00:00
Mariusz Felisiak 456e274578
gh-112451: Prohibit subclassing of datetime.timezone. (#114190)
This is consistent with C-extension datetime.timezone.
2024-01-26 09:33:13 +01:00
James Hilton-Balfe 7d57288f6d
gh-109495: Remove unused slots from the Python implementation of datetime (GH-109494) 2023-09-29 19:57:32 +03:00
Christopher Yeh 5eec58a9e5
Fix date.__repr__() docstring (#109422) 2023-09-15 15:05:19 +02:00
Mikhail Samylov 60a9eea3f5
Docs: Fix typo in datetime.tzinfo docstring (#107257)
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-09-06 21:29:46 +00:00
Serhiy Storchaka 6f3c138dfa
gh-108751: Add copy.replace() function (GH-108752)
It creates a modified copy of an object by calling the object's
__replace__() method.

It is a generalization of dataclasses.replace(), named tuple's _replace()
method and replace() methods in various classes, and supports all these
stdlib classes.
2023-09-06 23:55:42 +03:00
William Andrea d5c5d4bfd3
gh-106392: Fix inconsistency in deprecation warnings (#106436)
They used "datetime" to refer to both the object and the module.
2023-09-01 22:31:21 +00:00
Paul Ganssle 0a5cd984b2 GH-84976: Re-introduce `datetime.py` and fix reprs
Without the change to the reprs, pure-python classes would have a repr
of `datetime._pydatetime.time`, etc.
2023-05-03 03:09:45 -06:00
Paul Ganssle 65c4a2b326 GH-84976: Move Lib/datetime.py to Lib/_pydatetime
This breaks the tests, but we are keeping it as a separate commit so
that the move operation and editing of the moved files are separate, for
a cleaner history.
2023-05-03 03:09:45 -06:00