Description: utcfromtimestamp() is deprecated in Python 3.12
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2023-12-23

--- python-passlib-1.7.4.orig/passlib/tests/test_totp.py
+++ python-passlib-1.7.4/passlib/tests/test_totp.py
@@ -62,9 +62,9 @@ def _get_max_time_t():
     while True:
         next_value = value << 1
         try:
-            next_year = datetime.datetime.utcfromtimestamp(next_value-1).year
+            next_year = datetime.datetime.fromtimestamp(next_value-1, datetime.UTC).year
         except (ValueError, OSError, OverflowError):
-            # utcfromtimestamp() may throw any of the following:
+            # fromtimestamp() may throw any of the following:
             #
             # * year out of range for datetime:
             #   py < 3.6 throws ValueError.
@@ -787,7 +787,7 @@ class TotpTest(TestCase):
 
             self.assertEqual(otp.normalize_time(tint), tint)
 
-            dt = datetime.datetime.utcfromtimestamp(time)
+            dt = datetime.datetime.fromtimestamp(time, datetime.UTC)
             self.assertEqual(otp.normalize_time(dt), tint)
 
             orig = TotpFactory.now
@@ -890,7 +890,7 @@ class TotpTest(TestCase):
         self.assertNotEqual(otp.generate(start_time + 30).token, token)
 
         # verify round-trip conversion of datetime
-        dt = datetime.datetime.utcfromtimestamp(time)
+        dt = datetime.datetime.fromtimestamp(time, datetime.UTC)
         self.assertEqual(int(otp.normalize_time(dt)), int(time))
 
         # handle datetime object
@@ -1053,7 +1053,7 @@ class TotpTest(TestCase):
         #-------------------------------
 
         # handle datetimes
-        dt = datetime.datetime.utcfromtimestamp(time)
+        dt = datetime.datetime.fromtimestamp(time, datetime.UTC)
         assertMatches(0, token, dt, window=0)
 
         # reject invalid time
diff --git a/passlib/_setup/stamp.py b/passlib/_setup/stamp.py
index f14c0d4..3f6b92a 100644
--- a/passlib/_setup/stamp.py
+++ b/passlib/_setup/stamp.py
@@ -111,7 +111,7 @@ def append_hg_revision(version):
     except (OSError, subprocess.CalledProcessError):
         # fallback - just use build date
         now = int(os.environ.get('SOURCE_DATE_EPOCH') or time.time())
-        build_date = datetime.datetime.utcfromtimestamp(now)
+        build_date = datetime.datetime.now(datetime.UTC)
         stamp = build_date.strftime("%Y%m%d%H%M%S")
 
     # modify version
