gh-76075: Correct datetime.timestamp documentation (#131202)

* Clean up timestamp docs

* Update datetime.rst

* Suggestion
This commit is contained in:
Stan Ulbrych 2025-05-20 17:18:53 +01:00 committed by GitHub
parent ec39fd2c20
commit 86397cf65d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1502,11 +1502,11 @@ Instance methods:
returned by :func:`time.time`.
Naive :class:`.datetime` instances are assumed to represent local
time and this method relies on the platform C :c:func:`mktime`
function to perform the conversion. Since :class:`.datetime`
supports wider range of values than :c:func:`mktime` on many
platforms, this method may raise :exc:`OverflowError` or :exc:`OSError`
for times far in the past or far in the future.
time and this method relies on platform C functions to perform
the conversion. Since :class:`.datetime` supports a wider range of
values than the platform C functions on many platforms, this
method may raise :exc:`OverflowError` or :exc:`OSError` for times
far in the past or far in the future.
For aware :class:`.datetime` instances, the return value is computed
as::
@ -1519,6 +1519,10 @@ Instance methods:
The :meth:`timestamp` method uses the :attr:`.fold` attribute to
disambiguate the times during a repeated interval.
.. versionchanged:: 3.6
This method no longer relies on the platform C :c:func:`mktime`
function to perform conversions.
.. note::
There is no method to obtain the POSIX timestamp directly from a