https://github.com/python/cpython/commit/bb551578f0d13bea97229ab2c208d2b5e1e2d9bb
commit: bb551578f0d13bea97229ab2c208d2b5e1e2d9bb
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-10-21T19:19:01Z
summary:

gh-74876: Skip weakref pickling tests in test_xpickle for Python < 3.16 
(GH-160082)

Co-authored-by: Claude Opus 5.5 <[email protected]>

files:
M Lib/test/pickletester.py

diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index ed669ff7f1bc22..9c0679d1d13d23 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -3638,6 +3638,8 @@ def test_newobj_proxies(self):
                     self.assertEqual(x.__dict__, y.__dict__, detail)
 
     def test_weakref(self):
+        if self.py_version < (3, 16):
+            self.skipTest('not supported in Python < 3.16')
         obj = WeakrefTarget()
         wr = weakref.ref(obj)
         for proto in protocols:
@@ -3650,6 +3652,8 @@ def test_weakref(self):
                 self.assertIs(wr2(), obj2)
 
     def test_weakref_callback(self):
+        if self.py_version < (3, 16):
+            self.skipTest('not supported in Python < 3.16')
         # The callback is not preserved: pickling it strongly would defeat
         # the weak-only detection.
         obj = WeakrefTarget()
@@ -3661,6 +3665,8 @@ def test_weakref_callback(self):
                 self.assertIsNone(wr2.__callback__)
 
     def test_dead_weakref(self):
+        if self.py_version < (3, 16):
+            self.skipTest('not supported in Python < 3.16')
         # A dead reference stays dead, and all dead references unpickle as
         # the same object.
         obj = WeakrefTarget()

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to