forked from pool/python-cloudpickle
- Add patch support-python-314.patch:
* Fix a test to pass under Python 3.14. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cloudpickle?expand=0&rev=62
This commit is contained in:
32
support-python-314.patch
Normal file
32
support-python-314.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From d384a3b618d85fe5ae345c14bc46a5d1b48ba0ab Mon Sep 17 00:00:00 2001
|
||||
From: Victor Stinner <vstinner@python.org>
|
||||
Date: Mon, 26 May 2025 20:29:09 +0200
|
||||
Subject: [PATCH] Fix #567: Fix test_locally_defined_class_with_type_hints()
|
||||
|
||||
Update the test for Python 3.14 beta 1. What's New in Python 3.14
|
||||
says:
|
||||
|
||||
"In previous releases, it was sometimes possible to access class
|
||||
annotations from an instance of an annotated class. This behavior was
|
||||
undocumented and accidental, and will no longer work in Python 3.14."
|
||||
|
||||
https://docs.python.org/3.14/whatsnew/3.14.html#related-changes
|
||||
---
|
||||
tests/cloudpickle_test.py | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/cloudpickle_test.py b/tests/cloudpickle_test.py
|
||||
index 72aa132f..3647617d 100644
|
||||
--- a/tests/cloudpickle_test.py
|
||||
+++ b/tests/cloudpickle_test.py
|
||||
@@ -2658,7 +2658,9 @@ def method(self, arg: type_) -> type_:
|
||||
MyClass.__annotations__ = {"attribute": type_}
|
||||
|
||||
def check_annotations(obj, expected_type, expected_type_str):
|
||||
- assert obj.__annotations__["attribute"] == expected_type
|
||||
+ # On Python 3.14, it's no longer possible to access class
|
||||
+ # annotations from an instance, so use type().
|
||||
+ assert type(obj).__annotations__["attribute"] == expected_type
|
||||
assert obj.method.__annotations__["arg"] == expected_type
|
||||
assert obj.method.__annotations__["return"] == expected_type
|
||||
return "ok"
|
||||
Reference in New Issue
Block a user