Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-141004: Document missingPyDateTime* APIs.#141543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@ZeroIntensity
Copy link
Member

@ZeroIntensityZeroIntensity commentedNov 14, 2025
edited by bedevere-appbot
Loading

I was mostly inspired by Bénédikt's work on thecurses C API (#141254) for this.

In the future, I think we should completely deprecatePyDateTimeAPI andPyDateTime_IMPORT because of subinterpreter incompatibility, as well as documenting all the fields onPyDateTime_CAPI to make this usable under subinterpreters, but that's a later project.


📚 Documentation preview 📚:https://cpython-previews--141543.org.readthedocs.build/en/141543/c-api/datetime.html


.. c:macro:: PyDateTime_IMPORT()

Import the datetime C API. The macro does not need a semi-colon to be called.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The macro does not need a semi-colon to be called.

This is wrong.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes, I should've fact-checked this one before copy-pasting it. Good catch!

ZeroIntensityand others added3 commitsNovember 14, 2025 06:17
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@pganssle
Copy link
Member

This sounded familiar so I thought there was some reason that we didn't do it, but apparently I actually wanted to go even further than this and didn't get around to it / didn't drum up enough interest:#83785

I am tempted to say we should not say the thing about the struct contents being private and subject to change because there are situations where they are legitimately the only way to accomplish things and I am not crazy about the fact that our public interface is C macros anyway (given that those macros don't work outside of C++, I'd rather they be symbols that can be linked against in an FFI).

Given the subinterpreter stuff, though, it might be a bit of an own goal to make the struct public right awaybefore making a plan for how to move forward (in case the implementation details of the struct end up being inconvenient in that effort), so I'm +1 on the current scope of this PR.

@StanFromIrelandStanFromIreland changed the titlegh-141004: Document missingPyDateTime* APIs.gh-83785: Document missingPyDateTime* APIs.Nov 14, 2025
@StanFromIreland
Copy link
Member

This sounded familiar so I thought there was some reason that we didn't do it, but apparently I actually wanted to go even further than this and didn't get around to it / didn't drum up enough interest:#83785

Oh I forgot about that one! I've moved this PR under it, since it is more specific.

@ZeroIntensity
Copy link
MemberAuthor

I'm fine with removing the note on the contents ofPyDateTime_CAPI being private, would you like me to do that?

Oh I forgot about that one! I've moved this PR under it, since it is more specific.

Please don't edit my PRs without my permission. I don't think this PR fits great under that issue; we're merely documenting thatPyDateTimeAPI /PyDateTime_CAPI exist so they show up in Sphinx, whereas that issue seems more about documenting the contents of them. I'm happy to use that issue for the future work Paul and I were talking about in regards to FFIs and thread-safety.

@ZeroIntensityZeroIntensity changed the titlegh-83785: Document missingPyDateTime* APIs.gh-141004: Document missingPyDateTime* APIs.Nov 14, 2025
@StanFromIreland
Copy link
Member

Apologies Peter.

ZeroIntensity reacted with heart emoji

@pganssle
Copy link
Member

pganssle commentedNov 14, 2025
edited
Loading

I'm fine with removing the note on the contents ofPyDateTime_CAPI being private, would you like me to do that?

No I think we should leave it. If we later decide that we're going to officially expose them publicly without any changes we can always backport the docs changes to older versions to retroactively document it.

ZeroIntensity reacted with thumbs up emoji

@ZeroIntensity
Copy link
MemberAuthor

I created#141563 for discussion on the global variable.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM, I just left minor suggestions.

.. code-block::

PyDateTime_IMPORT;
if (PyErr_Occurred()) { /* cleanup */ }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
if (PyErr_Occurred()) { /*cleanup */ }
if (PyErr_Occurred()) { /*error */ }

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I like the current comment, we do similar for the curses C API:https://docs.python.org/3/c-api/curses.html

vstinner reacted with thumbs up emoji
Co-authored-by: Victor Stinner <vstinner@python.org>
@ZeroIntensityZeroIntensity merged commit4273616 intopython:mainNov 20, 2025
28 checks passed
@ZeroIntensityZeroIntensity deleted the document-datetime-capsule-name branchNovember 20, 2025 13:48
@github-project-automationgithub-project-automationbot moved this fromTodo toDone inDocs PRsNov 20, 2025
@ZeroIntensityZeroIntensity added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsNov 20, 2025
@miss-islington-app
Copy link

Thanks@ZeroIntensity for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks@ZeroIntensity for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestNov 20, 2025
(cherry picked from commit4273616)Co-authored-by: Peter Bierma <zintensitydev@gmail.com>Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app
Copy link

GH-141791 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelNov 20, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestNov 20, 2025
(cherry picked from commit4273616)Co-authored-by: Peter Bierma <zintensitydev@gmail.com>Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app
Copy link

GH-141792 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelNov 20, 2025
ZeroIntensity added a commit that referenced this pull requestNov 20, 2025
…-141791)gh-141004: Document missing `PyDateTime*` APIs (GH-141543)(cherry picked from commit4273616)Co-authored-by: Peter Bierma <zintensitydev@gmail.com>Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>Co-authored-by: Victor Stinner <vstinner@python.org>
ZeroIntensity added a commit that referenced this pull requestNov 20, 2025
…-141792)gh-141004: Document missing `PyDateTime*` APIs (GH-141543)(cherry picked from commit4273616)Co-authored-by: Peter Bierma <zintensitydev@gmail.com>Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>Co-authored-by: Victor Stinner <vstinner@python.org>
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull requestDec 6, 2025
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>Co-authored-by: Victor Stinner <vstinner@python.org>
ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull requestDec 8, 2025
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@StanFromIrelandStanFromIrelandStanFromIreland left review comments

@vstinnervstinnervstinner approved these changes

@pgansslepganssleAwaiting requested review from pgansslepganssle is a code owner

@abalkinabalkinAwaiting requested review from abalkinabalkin is a code owner

Assignees

No one assigned

Labels

docsDocumentation in the Doc dirskip news

Projects

Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@ZeroIntensity@pganssle@StanFromIreland@vstinner

[8]ページ先頭

©2009-2026 Movatter.jp