15
0

Accepting request 1307024 from devel:languages:python

- Add patch support-python-314.patch:
  * Fix a test to pass under Python 3.14.

OBS-URL: https://build.opensuse.org/request/show/1307024
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cloudpickle?expand=0&rev=27
This commit is contained in:
2025-09-26 20:24:09 +00:00
committed by Git OBS Bridge
3 changed files with 41 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Sep 25 05:14:58 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python-314.patch:
* Fix a test to pass under Python 3.14.
-------------------------------------------------------------------
Thu Jan 23 11:08:09 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-cloudpickle
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,6 +24,8 @@ Summary: Extended pickling support for Python objects
License: BSD-3-Clause
URL: https://github.com/cloudpipe/cloudpickle
Source: https://github.com/cloudpipe/cloudpickle/archive/refs/tags/v{%version}.tar.gz#/cloudpickle-%{version}-gh.tar.gz
# PATCH-FIX-UPSTREAM gh#cloudpipe/cloudpickle#570
Patch0: support-python-314.patch
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module flit-core}
BuildRequires: %{python_module pip}

32
support-python-314.patch Normal file
View 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"