From 3c300a04a831605ce468c54fbbaa12bce578be1c Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Wed, 15 May 2024 10:43:50 +0200 Subject: [PATCH] Fix test_extract_class_dict for Python 3.13 beta 1 Resolves: https://github.com/cloudpipe/cloudpickle/issues/533 --- tests/cloudpickle_test.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/cloudpickle_test.py b/tests/cloudpickle_test.py index 5aa4baca..af5ef3e3 100644 --- a/tests/cloudpickle_test.py +++ b/tests/cloudpickle_test.py @@ -110,7 +110,12 @@ def method_c(self): return "c" clsdict = _extract_class_dict(C) - assert list(clsdict.keys()) == ["C_CONSTANT", "__doc__", "method_c"] + expected_keys = ["C_CONSTANT", "__doc__", "method_c"] + # New attribute in Python 3.13 beta 1 + # https://github.com/python/cpython/pull/118475 + if sys.version_info >= (3, 13): + expected_keys.insert(2, "__firstlineno__") + assert list(clsdict.keys()) == expected_keys assert clsdict["C_CONSTANT"] == 43 assert clsdict["__doc__"] is None assert clsdict["method_c"](C()) == C().method_c()