GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Mock `datetime.date.today()` directly by frenzymadness · Pull Request #618 · adamchainz/time-machine

Conversation

@frenzymadness

@frenzymadness frenzymadness commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Since datetime.datetime.today() inherits from date.today(), we patch date.today() once with a unified wrapper that checks the calling class type and dispatches to the appropriate function. This ensures both date.today() and datetime.today() work correctly and return the right type.

Related to: python/cpython@fc3e22a
Fixes: #610

This fix is vibe-coded and tested with Python 3.15 alpha 7, and the code looks reasonable to me. We're going to test it more with packages that use time-machine in Fedora Linux.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tjkirch reacted with thumbs down emoji
All reactions
  • 👎 1 reaction
@adamchainz

adamchainz commented Apr 2, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR, I'll review it properly when I can.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@maurycy maurycy mentioned this pull request May 14, 2026
gh-148085: datetime cache time module lookups python/cpython#148088
Merged
maurycy
maurycy reviewed May 14, 2026
View reviewed changes
Comment thread src/_time_machine.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@adamchainz
adamchainz force-pushed the py315 branch from 164cc84 to ea1c4ae Compare July 29, 2026 21:45
@adamchainz adamchainz changed the title Add date.today() and datetime.today() patching for Python 3.15+ Mock datetime.date.today() directly Jul 29, 2026
frenzymadness and others added 7 commits July 29, 2026 22:50
@frenzymadness @adamchainz
Add date.today() and datetime.today() patching for Python 3.15+
5996962
Since datetime.datetime.today() inherits from date.today(), we patch
date.today() once with a unified wrapper that checks the calling class
type and dispatches to the appropriate function. This ensures both
date.today() and datetime.today() work correctly and return the right type.

Related to: python/cpython@fc3e22a
Fixes: adamchainz#610
@adamchainz
Test escape hatch functions
f62ab91
@adamchainz
Alphabetize EH funcs
4723995
@adamchainz
doc escape hatch funcs
9a003ed
@adamchainz
doc mocked funcs
1384c25
@adamchainz
changelog note
99bcd3e
@adamchainz
Simplify
8aa5139
@adamchainz
adamchainz force-pushed the py315 branch from ea1c4ae to 8aa5139 Compare July 29, 2026 21:51
@adamchainz
adamchainz enabled auto-merge (squash) July 29, 2026 21:52
@adamchainz
adamchainz merged commit 83c3851 into adamchainz:main Jul 29, 2026
12 checks passed

Uh oh!

There was an error while loading. Please reload this page.

inmantaci pushed a commit to inmanta/inmanta-core that referenced this pull request Aug 3, 2026
@dependabot @inmantaci
Bump time-machine from 3.2.0 to 3.3.0 (PR #10643)
225c663
Bumps [time-machine](https://github.com/adamchainz/time-machine) from 3.2.0 to 3.3.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/adamchainz/time-machine/blob/main/docs/changelog.rst">time-machine's changelog</a>.</em></p>
<blockquote>
<h2>3.3.0 (2026-07-31)</h2>
<ul>
<li>
<p>Support Python 3.15.</p>
<p><code>PR [#631](adamchainz/time-machine#631) &lt;https://github.com/adamchainz/time-machine/pull/631&gt;</code>__.</p>
</li>
<li>
<p>Mock <code>datetime.date.today()</code> directly, for Python 3.15 support.</p>
<p>Previously time-machine was mocked only indirectly, since CPython implemented it by calling <code>cls.fromtimestamp(time.time())</code>.
Python 3.15 added a fast path that reads the system clock directly (<code>CPython Issue [#130980](https://github.com/adamchainz/time-machine/issues/130980) &lt;https://github.com/python/cpython/pull/130980&gt;</code>__), so time travel no longer affected it, which the new mock fixes.
Consequently, there are new :ref:<code>escape hatch &lt;escape-hatch&gt;</code> functions: <code>escape_hatch.datetime.date.today()</code> and <code>escape_hatch.datetime.datetime.today()</code>.</p>
<p>Thanks to Miro Hrončok and Karolina Surma for the report in <code>Issue [#610](adamchainz/time-machine#610) &lt;https://github.com/adamchainz/time-machine/issues/610&gt;</code><strong>, Lumír 'Frenzy' Balhar for the fix in <code>PR [#618](adamchainz/time-machine#618) &lt;https://github.com/adamchainz/time-machine/pull/618&gt;</code></strong>, and Maurycy Pawłowski-Wieroński for review</p>
</li>
<li>
<p>Support isolated subinterpreters, as created by |concurrent.interpreters|__ on Python 3.14+.
Previously, importing time-machine in an isolated subinterpreter failed with an <code>ImportError</code>.</p>
<p>.. |concurrent.interpreters| replace:: <code>concurrent.interpreters</code>
__ <a href="https://docs.python.org/3.14/library/concurrent.interpreters.html">https://docs.python.org/3.14/library/concurrent.interpreters.html</a></p>
<p><code>PR [#644](adamchainz/time-machine#644) &lt;https://github.com/adamchainz/time-machine/pull/644&gt;</code>__.</p>
</li>
<li>
<p>Move the intermediary functions that patched functions call from Python to C.
This change reduces the overhead of calling patched functions like <code>time.time()</code> while time travelling, making them around 10-20% faster.</p>
<p><code>PR [#643](adamchainz/time-machine#643) &lt;https://github.com/adamchainz/time-machine/pull/643&gt;</code>__.</p>
</li>
<li>
<p>Fix returning <code>datetime</code> subclasses from their <code>now()</code> and <code>utcnow()</code> methods while time travelling.
Previously, time-machine would always return a plain <code>datetime.datetime</code> instance, rather than the subclass.</p>
<p><code>PR [#643](adamchainz/time-machine#643) &lt;https://github.com/adamchainz/time-machine/pull/643&gt;</code>__.</p>
</li>
<li>
<p>Fix hiding of the <code>DeprecationWarning</code> from |datetime.utcnow()|__ on Python 3.12+ while time travelling.
Previously, the mocked version of the function did not raise the warning at all, so deprecated calls could pass unnoticed in tests.
The warning is attributed to the calling code, like the real function does.</p>
<p>.. |datetime.utcnow()| replace:: <code>datetime.utcnow()</code>
__ <a href="https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow">https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow</a></p>
<p>The :ref:<code>escape hatch &lt;escape-hatch&gt;</code> function <code>escape_hatch.datetime.datetime.utcnow()</code> also now attributes its warning to the calling code, rather than to a line within time-machine.</p>
<p><code>PR [#649](adamchainz/time-machine#649) &lt;https://github.com/adamchainz/time-machine/pull/&gt;</code><strong>.
Thanks to Tamir Duberstein for the report in <code>Issue [#445](adamchainz/time-machine#445) &lt;https://github.com/adamchainz/time-machine/issues/445&gt;</code></strong> and Anders Kaseorg for the initial implementation in <code>PR [#486](adamchainz/time-machine#486) &lt;https://github.com/adamchainz/time-machine/pull/486&gt;</code>__.</p>
</li>
<li>
<p>Fix the standard |uuid|__ library functions <code>uuid1()</code>, <code>uuid6()</code>, and <code>uuid7()</code> to correctly generate values for the destination when time travels backwards.
These functions cache the timestamp of the value they generated most recently, and never generate a value stamped before it.
Previously, after time-travelling backwards, these functions would keep generating values stamped for the cached timestamp, rather than the new destination.
The caches are now reset whenever time travel starts, stops, or moves backwards.</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/adamchainz/time-machine/commit/206d32e062f8e2c78dfa25f0d3c02fe3a5112092"><code>206d32e</code></a> Version 3.3.0</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/adfd496632097e6dda259bdbcf396fdaaecc5030"><code>adfd496</code></a> Support isolated subinterpreters (<a href="https://redirect.github.com/adamchainz/time-machine/issues/644">#644</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/4e1a98d83f78f7b79086c0a6b7314058787f834d"><code>4e1a98d</code></a> Reorder changelog</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/5ad9391741900713b619a1ee585f580320406469"><code>5ad9391</code></a> Raise the <code>DeprecationWarning</code> for <code>utcnow()</code> while time travelling (<a href="https://redirect.github.com/adamchainz/time-machine/issues/649">#649</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/facaaa0e99bbc586770b9241dead7351e7ab1408"><code>facaaa0</code></a> Reset uuid module's cached timestamps when time travelling backwards (<a href="https://redirect.github.com/adamchainz/time-machine/issues/648">#648</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/811eaec9fcb81aeac8b9545c3527edff2dda7c80"><code>811eaec</code></a> Make Migration CLI rewrite <code>freeze_time</code> from-imports with several names (<a href="https://redirect.github.com/adamchainz/time-machine/issues/647">#647</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/4eae77b0019a83e2b7bd25df2d6c9c93ed5be52f"><code>4eae77b</code></a> Refactor Migration CLI call rewriting into a shared function (<a href="https://redirect.github.com/adamchainz/time-machine/issues/646">#646</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/c21eab560824f470426493791094769d405547a3"><code>c21eab5</code></a> Fix Migration CLI rewriting relative <code>freezegun</code> imports (<a href="https://redirect.github.com/adamchainz/time-machine/issues/645">#645</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/58b9fede27166a203b6b37d7ec7352026c3662ec"><code>58b9fed</code></a> Make Migration CLI update <code>freeze_time()</code> decorators on async functions (<a href="https://redirect.github.com/adamchainz/time-machine/issues/640">#640</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/9d0474beb169e54cb492de3f8c87b2bfbb25386d"><code>9d0474b</code></a> Make Migration CLI update <code>freeze_time()</code> calls that pass <code>tick</code> (<a href="https://redirect.github.com/adamchainz/time-machine/issues/636">#636</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/adamchainz/time-machine/compare/3.2.0...3.3.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=time-machine&package-manager=pip&previous-version=3.2.0&new-version=3.3.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>
inmantaci pushed a commit to inmanta/inmanta-core that referenced this pull request Aug 3, 2026
@dependabot @inmantaci
Bump time-machine from 3.2.0 to 3.3.0 (PR #10645)
f0f92e8
Bumps [time-machine](https://github.com/adamchainz/time-machine) from 3.2.0 to 3.3.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/adamchainz/time-machine/blob/main/docs/changelog.rst">time-machine's changelog</a>.</em></p>
<blockquote>
<h2>3.3.0 (2026-07-31)</h2>
<ul>
<li>
<p>Support Python 3.15.</p>
<p><code>PR [#631](adamchainz/time-machine#631) &lt;https://github.com/adamchainz/time-machine/pull/631&gt;</code>__.</p>
</li>
<li>
<p>Mock <code>datetime.date.today()</code> directly, for Python 3.15 support.</p>
<p>Previously time-machine was mocked only indirectly, since CPython implemented it by calling <code>cls.fromtimestamp(time.time())</code>.
Python 3.15 added a fast path that reads the system clock directly (<code>CPython Issue [#130980](https://github.com/adamchainz/time-machine/issues/130980) &lt;https://github.com/python/cpython/pull/130980&gt;</code>__), so time travel no longer affected it, which the new mock fixes.
Consequently, there are new :ref:<code>escape hatch &lt;escape-hatch&gt;</code> functions: <code>escape_hatch.datetime.date.today()</code> and <code>escape_hatch.datetime.datetime.today()</code>.</p>
<p>Thanks to Miro Hrončok and Karolina Surma for the report in <code>Issue [#610](adamchainz/time-machine#610) &lt;https://github.com/adamchainz/time-machine/issues/610&gt;</code><strong>, Lumír 'Frenzy' Balhar for the fix in <code>PR [#618](adamchainz/time-machine#618) &lt;https://github.com/adamchainz/time-machine/pull/618&gt;</code></strong>, and Maurycy Pawłowski-Wieroński for review</p>
</li>
<li>
<p>Support isolated subinterpreters, as created by |concurrent.interpreters|__ on Python 3.14+.
Previously, importing time-machine in an isolated subinterpreter failed with an <code>ImportError</code>.</p>
<p>.. |concurrent.interpreters| replace:: <code>concurrent.interpreters</code>
__ <a href="https://docs.python.org/3.14/library/concurrent.interpreters.html">https://docs.python.org/3.14/library/concurrent.interpreters.html</a></p>
<p><code>PR [#644](adamchainz/time-machine#644) &lt;https://github.com/adamchainz/time-machine/pull/644&gt;</code>__.</p>
</li>
<li>
<p>Move the intermediary functions that patched functions call from Python to C.
This change reduces the overhead of calling patched functions like <code>time.time()</code> while time travelling, making them around 10-20% faster.</p>
<p><code>PR [#643](adamchainz/time-machine#643) &lt;https://github.com/adamchainz/time-machine/pull/643&gt;</code>__.</p>
</li>
<li>
<p>Fix returning <code>datetime</code> subclasses from their <code>now()</code> and <code>utcnow()</code> methods while time travelling.
Previously, time-machine would always return a plain <code>datetime.datetime</code> instance, rather than the subclass.</p>
<p><code>PR [#643](adamchainz/time-machine#643) &lt;https://github.com/adamchainz/time-machine/pull/643&gt;</code>__.</p>
</li>
<li>
<p>Fix hiding of the <code>DeprecationWarning</code> from |datetime.utcnow()|__ on Python 3.12+ while time travelling.
Previously, the mocked version of the function did not raise the warning at all, so deprecated calls could pass unnoticed in tests.
The warning is attributed to the calling code, like the real function does.</p>
<p>.. |datetime.utcnow()| replace:: <code>datetime.utcnow()</code>
__ <a href="https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow">https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow</a></p>
<p>The :ref:<code>escape hatch &lt;escape-hatch&gt;</code> function <code>escape_hatch.datetime.datetime.utcnow()</code> also now attributes its warning to the calling code, rather than to a line within time-machine.</p>
<p><code>PR [#649](adamchainz/time-machine#649) &lt;https://github.com/adamchainz/time-machine/pull/&gt;</code><strong>.
Thanks to Tamir Duberstein for the report in <code>Issue [#445](adamchainz/time-machine#445) &lt;https://github.com/adamchainz/time-machine/issues/445&gt;</code></strong> and Anders Kaseorg for the initial implementation in <code>PR [#486](adamchainz/time-machine#486) &lt;https://github.com/adamchainz/time-machine/pull/486&gt;</code>__.</p>
</li>
<li>
<p>Fix the standard |uuid|__ library functions <code>uuid1()</code>, <code>uuid6()</code>, and <code>uuid7()</code> to correctly generate values for the destination when time travels backwards.
These functions cache the timestamp of the value they generated most recently, and never generate a value stamped before it.
Previously, after time-travelling backwards, these functions would keep generating values stamped for the cached timestamp, rather than the new destination.
The caches are now reset whenever time travel starts, stops, or moves backwards.</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/adamchainz/time-machine/commit/206d32e062f8e2c78dfa25f0d3c02fe3a5112092"><code>206d32e</code></a> Version 3.3.0</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/adfd496632097e6dda259bdbcf396fdaaecc5030"><code>adfd496</code></a> Support isolated subinterpreters (<a href="https://redirect.github.com/adamchainz/time-machine/issues/644">#644</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/4e1a98d83f78f7b79086c0a6b7314058787f834d"><code>4e1a98d</code></a> Reorder changelog</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/5ad9391741900713b619a1ee585f580320406469"><code>5ad9391</code></a> Raise the <code>DeprecationWarning</code> for <code>utcnow()</code> while time travelling (<a href="https://redirect.github.com/adamchainz/time-machine/issues/649">#649</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/facaaa0e99bbc586770b9241dead7351e7ab1408"><code>facaaa0</code></a> Reset uuid module's cached timestamps when time travelling backwards (<a href="https://redirect.github.com/adamchainz/time-machine/issues/648">#648</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/811eaec9fcb81aeac8b9545c3527edff2dda7c80"><code>811eaec</code></a> Make Migration CLI rewrite <code>freeze_time</code> from-imports with several names (<a href="https://redirect.github.com/adamchainz/time-machine/issues/647">#647</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/4eae77b0019a83e2b7bd25df2d6c9c93ed5be52f"><code>4eae77b</code></a> Refactor Migration CLI call rewriting into a shared function (<a href="https://redirect.github.com/adamchainz/time-machine/issues/646">#646</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/c21eab560824f470426493791094769d405547a3"><code>c21eab5</code></a> Fix Migration CLI rewriting relative <code>freezegun</code> imports (<a href="https://redirect.github.com/adamchainz/time-machine/issues/645">#645</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/58b9fede27166a203b6b37d7ec7352026c3662ec"><code>58b9fed</code></a> Make Migration CLI update <code>freeze_time()</code> decorators on async functions (<a href="https://redirect.github.com/adamchainz/time-machine/issues/640">#640</a>)</li>
<li><a href="https://github.com/adamchainz/time-machine/commit/9d0474beb169e54cb492de3f8c87b2bfbb25386d"><code>9d0474b</code></a> Make Migration CLI update <code>freeze_time()</code> calls that pass <code>tick</code> (<a href="https://redirect.github.com/adamchainz/time-machine/issues/636">#636</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/adamchainz/time-machine/compare/3.2.0...3.3.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=time-machine&package-manager=pip&previous-version=3.2.0&new-version=3.3.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>
mcmcgrath13 pushed a commit to CDCgov/NEDSS-Modernization that referenced this pull request Aug 11, 2026
@dependabot
build(deps-dev): bump time-machine from 3.2.0 to 3.3.1 in /apps/repor…
cf1fb11
…t-execution (#3569)

Bumps [time-machine](https://github.com/adamchainz/time-machine) from
3.2.0 to 3.3.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/adamchainz/time-machine/blob/main/docs/changelog.rst">time-machine's
changelog</a>.</em></p>
<blockquote>
<h2>3.3.1 (2026-08-04)</h2>
<ul>
<li>
<p>Fix small rounding errors in destination calculations.</p>
<p>Previously, time-machine computed destinations in floating-point
seconds, which could lead to small rounding errors: up to a few hundred
nanoseconds for present-day destinations, growing to several
microseconds by the year 2500.
This change fixes the pipeline to use integer nanoseconds throughout, so
time-travel is precise for any supported date.</p>
<p><code>PR
[#651](adamchainz/time-machine#651)
&lt;https://github.com/adamchainz/time-machine/pull/651&gt;</code>__.</p>
</li>
</ul>
<h2>3.3.0 (2026-07-31)</h2>
<ul>
<li>
<p>Support Python 3.15.</p>
<p><code>PR
[#631](adamchainz/time-machine#631)
&lt;https://github.com/adamchainz/time-machine/pull/631&gt;</code>__.</p>
</li>
<li>
<p>Mock <code>datetime.date.today()</code> directly, for Python 3.15
support.</p>
<p>Previously time-machine was mocked only indirectly, since CPython
implemented it by calling <code>cls.fromtimestamp(time.time())</code>.
Python 3.15 added a fast path that reads the system clock directly
(<code>CPython Issue
[#130980](https://github.com/adamchainz/time-machine/issues/130980)
&lt;https://github.com/python/cpython/pull/130980&gt;</code>__), so time
travel no longer affected it, which the new mock fixes.
Consequently, there are new :ref:<code>escape hatch
&lt;escape-hatch&gt;</code> functions:
<code>escape_hatch.datetime.date.today()</code> and
<code>escape_hatch.datetime.datetime.today()</code>.</p>
<p>Thanks to Miro Hrončok and Karolina Surma for the report in
<code>Issue
[#610](adamchainz/time-machine#610)
&lt;https://github.com/adamchainz/time-machine/issues/610&gt;</code><strong>,
Lumír 'Frenzy' Balhar for the fix in <code>PR
[#618](adamchainz/time-machine#618)
&lt;https://github.com/adamchainz/time-machine/pull/618&gt;</code></strong>,
and Maurycy Pawłowski-Wieroński for review</p>
</li>
<li>
<p>Support isolated subinterpreters, as created by
|concurrent.interpreters|__ on Python 3.14+.
Previously, importing time-machine in an isolated subinterpreter failed
with an <code>ImportError</code>.</p>
<p>.. |concurrent.interpreters| replace::
<code>concurrent.interpreters</code>
__ <a
href="https://docs.python.org/3.14/library/concurrent.interpreters.html">https://docs.python.org/3.14/library/concurrent.interpreters.html</a></p>
<p><code>PR
[#644](adamchainz/time-machine#644)
&lt;https://github.com/adamchainz/time-machine/pull/644&gt;</code>__.</p>
</li>
<li>
<p>Move the intermediary functions that patched functions call from
Python to C.
This change reduces the overhead of calling patched functions like
<code>time.time()</code> while time travelling, making them around
10-20% faster.</p>
<p><code>PR
[#643](adamchainz/time-machine#643)
&lt;https://github.com/adamchainz/time-machine/pull/643&gt;</code>__.</p>
</li>
<li>
<p>Fix returning <code>datetime</code> subclasses from their
<code>now()</code> and <code>utcnow()</code> methods while time
travelling.
Previously, time-machine would always return a plain
<code>datetime.datetime</code> instance, rather than the subclass.</p>
<p><code>PR
[#643](adamchainz/time-machine#643)
&lt;https://github.com/adamchainz/time-machine/pull/643&gt;</code>__.</p>
</li>
<li>
<p>Fix hiding of the <code>DeprecationWarning</code> from
|datetime.utcnow()|__ on Python 3.12+ while time travelling.
Previously, the mocked version of the function did not raise the warning
at all, so deprecated calls could pass unnoticed in tests.
The warning is attributed to the calling code, like the real function
does.</p>
<p>.. |datetime.utcnow()| replace:: <code>datetime.utcnow()</code>
__ <a
href="https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow">https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow</a></p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/adamchainz/time-machine/commit/eb7ac9e6666554dc6fbb0efa0eafb15756e62a86"><code>eb7ac9e</code></a>
Version 3.3.1</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/eff8136d84b2de67380d9db09fa2a54ac0447933"><code>eff8136</code></a>
Use canonical timezone name in
<code>test_destination_string_naive()</code> (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/652">#652</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/3d59d29e9ec71bca23c8061902b1c32195af177a"><code>3d59d29</code></a>
Add Hypothesis fuzz tests (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/653">#653</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/c8114b0bf7bfd00ff03e122b7db6a4b8dae903e9"><code>c8114b0</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/650">#650</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/b9de2a9163b2609e300f07824ead7f84d2926eba"><code>b9de2a9</code></a>
Use integer nanoseconds throughout destination handling (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/651">#651</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/206d32e062f8e2c78dfa25f0d3c02fe3a5112092"><code>206d32e</code></a>
Version 3.3.0</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/adfd496632097e6dda259bdbcf396fdaaecc5030"><code>adfd496</code></a>
Support isolated subinterpreters (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/644">#644</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/4e1a98d83f78f7b79086c0a6b7314058787f834d"><code>4e1a98d</code></a>
Reorder changelog</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/5ad9391741900713b619a1ee585f580320406469"><code>5ad9391</code></a>
Raise the <code>DeprecationWarning</code> for <code>utcnow()</code>
while time travelling (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/649">#649</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/facaaa0e99bbc586770b9241dead7351e7ab1408"><code>facaaa0</code></a>
Reset uuid module's cached timestamps when time travelling backwards (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/648">#648</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/adamchainz/time-machine/compare/3.2.0...3.3.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=time-machine&package-manager=uv&previous-version=3.2.0&new-version=3.3.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adamchainz adamchainz adamchainz left review comments
+1 more reviewer
@maurycy maurycy maurycy left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Test failures with Python 3.15.0a5: test_date_today + DeprecationWarnings

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@frenzymadness @adamchainz @maurycy
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.