Repository navigation
Commit ea453a1
Philipp Matthias Hahn
Python: Fix datetime.replace(tzinfo=None) with Python 3.13
Python 3.13 fixed [gh-89039][gh-89039]. Now `datetime.__new__()` is also
used for `datetime.replace()`, which is called with `tzinfo=None` to
convert a time-zone aware instance to a _naive_ instance. But
`__new__()` replaces `tzinfo=None` with `loczlTZ()`, which just re-adds
the offset back.
This breaks calling `database.update()` on all database records, which
use timestamps as a datetime with the wrong timezone offset is used.
Add a new singleton LTZ and use that instead of `tzinfo=None` to keep
the old behavior to get the local timezone by default.
Fixes: MythTV#1179
[gh-89039]: python/cpython#890391 parent 0ad9537 commit ea453a1
1 file changed
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| 307 | + | |
| 308 | + | |
307 | 309 | | |
308 | 310 | | |
309 | 311 | | |
| |||
343 | 345 | | |
344 | 346 | | |
345 | 347 | | |
346 | | - | |
347 | | - | |
| 348 | + | |
| 349 | + | |
348 | 350 | | |
349 | 351 | | |
350 | 352 | | |
| |||
382 | 384 | | |
383 | 385 | | |
384 | 386 | | |
385 | | - | |
| 387 | + | |
386 | 388 | | |
387 | 389 | | |
388 | 390 | | |
| |||
393 | 395 | | |
394 | 396 | | |
395 | 397 | | |
396 | | - | |
| 398 | + | |
397 | 399 | | |
398 | 400 | | |
399 | | - | |
| 401 | + | |
400 | 402 | | |
401 | 403 | | |
402 | 404 | | |
| |||
507 | 509 | | |
508 | 510 | | |
509 | 511 | | |
510 | | - | |
| 512 | + | |
511 | 513 | | |
512 | | - | |
| 514 | + | |
513 | 515 | | |
514 | 516 | | |
515 | 517 | | |
| |||
0 commit comments