File: py313-deprecation.patch

package info (click to toggle)
nbclient 0.8.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 760 kB
  • sloc: python: 2,751; makefile: 18
file content (43 lines) | stat: -rw-r--r-- 1,853 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From: =?utf-8?q?Miro_Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Mon, 10 Jun 2024 17:08:06 +0200
Subject: Avoid a DeprecationWarning on Python 3.13+

    ...
    /usr/lib/python3.13/site-packages/nbclient/jsonutil.py:29: in <module>
        datetime.strptime("1", "%d")
    /usr/lib64/python3.13/_strptime.py:573: in _strptime_datetime
        tt, fraction, gmtoff_fraction = _strptime(data_string, format)
    /usr/lib64/python3.13/_strptime.py:336: in _strptime
        format_regex = _TimeRE_cache.compile(format)
    /usr/lib64/python3.13/_strptime.py:282: in compile
        return re_compile(self.pattern(format), IGNORECASE)
    /usr/lib64/python3.13/_strptime.py:270: in pattern
        warnings.warn("""\
    E   DeprecationWarning: Parsing dates involving a day of month without a year specified is ambiguious
    E   and fails to parse leap day. The default behavior will change in Python 3.15
    E   to either always raise an exception or to use a different default year (TBD).
    E   To avoid trouble, add a specific year to the input & format.
    E   See https://github.com/python/cpython/issues/70647.

See also https://github.com/jupyter/jupyter_client/issues/1020

Origin: other, https://github.com/jupyter/nbclient/pull/315
Bug: https://github.com/jupyter/nbclient/issues/318
Last-Update: 2024-11-25
---
 nbclient/jsonutil.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nbclient/jsonutil.py b/nbclient/jsonutil.py
index e67ffd5..82b4660 100644
--- a/nbclient/jsonutil.py
+++ b/nbclient/jsonutil.py
@@ -25,7 +25,7 @@ ISO8601_PAT = re.compile(
 
 # holy crap, strptime is not threadsafe.
 # Calling it once at import seems to help.
-datetime.strptime("1", "%d")
+datetime.strptime("2000-01-01", "%Y-%m-%d")
 
 # -----------------------------------------------------------------------------
 # Classes and functions