Skip to content

gh-84976: Add _pydatetime module (Python datetime impl) #99090

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

gh-84976: Add _pydatetime module (Python datetime impl) #99090

wants to merge 1 commit into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Nov 4, 2022

Speedup import datetime by moving the Python implementation of the datetime module into a new Lib/_pydatetime.py file.

  • Define datetime.all in Lib/datetime.py.
  • _pydatetime.py defines name as 'datetime' for pickling.
  • TestModule.test_divide_and_round() now imports directly _pydatetime, since _divide_and_round() is no longer exported by the datetime module.
  • test_datetime also requires a fresh _pydatetime when loading pure_tests.

@sobolevn
Copy link
Member

sobolevn commented Nov 4, 2022

Linking gh issue: #84976

@AlexWaygood AlexWaygood changed the title bpo-40799: Add _pydatetime module (Python datetime impl) gh-84976: Add _pydatetime module (Python datetime impl) Nov 4, 2022
@vstinner
Copy link
Member Author

vstinner commented Nov 4, 2022

Linking gh issue: #84976

It's in the PR title and a link was automatically added to the PR description, it wasn't enough?

@sobolevn
Copy link
Member

sobolevn commented Nov 4, 2022

It was done right after my comment :)
Снимок экрана 2022-11-04 в 18 08 23

bpo- links no longer work.

Speedup import datetime by moving the Python implementation of the
datetime module into a new Lib/_pydatetime.py file.

* Define datetime.__all__ in Lib/datetime.py.
* _pydatetime.py defines __name__ as 'datetime' for pickling.
* TestModule.test_divide_and_round() now imports directly
  _pydatetime, since _divide_and_round() is no longer exported by the
  datetime module.
* test_datetime also requires a fresh _pydatetime when loading
  pure_tests.
@vstinner
Copy link
Member Author

vstinner commented Nov 4, 2022

It was done right after my comment :)

Oh ok, my commit title was outdated. I fixed it.

@vstinner
Copy link
Member Author

vstinner commented Nov 29, 2022

I closed my PR, rationale: #84976 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants