Fix decorate_class for Python 3.10 where staticmethod is callable

epel9
Miro Hrončok 4 years ago
parent 933e982bc0
commit da8be3f62b

@ -0,0 +1,26 @@
From e63874ce75a74a1159390914045fe8e7955b24c4 Mon Sep 17 00:00:00 2001
From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Date: Fri, 7 May 2021 15:51:33 +0000
Subject: [PATCH] Fix decorate_class for Python 3.10 where staticmethod is
callable.
---
freezegun/api.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/freezegun/api.py b/freezegun/api.py
index cab9ebe..55a80c7 100644
--- a/freezegun/api.py
+++ b/freezegun/api.py
@@ -598,7 +598,10 @@ def tearDownClass(cls):
continue
seen.add(attr)
- if not callable(attr_value) or inspect.isclass(attr_value):
+ # staticmethods are callable from Python 3.10 . Hence skip them from decoration
+ if (not callable(attr_value)
+ or inspect.isclass(attr_value)
+ or isinstance(attr_value, staticmethod)):
continue
try:

@ -10,6 +10,9 @@ License: ASL 2.0
URL: https://pypi.io/project/freezegun URL: https://pypi.io/project/freezegun
Source0: https://pypi.io/packages/source/f/%{modname}/%{modname}-%{version}.tar.gz Source0: https://pypi.io/packages/source/f/%{modname}/%{modname}-%{version}.tar.gz
# Fix decorate_class for Python 3.10 where staticmethod is callable
Patch1: https://github.com/spulec/freezegun/pull/397.patch
BuildArch: noarch BuildArch: noarch
%description %description

Loading…
Cancel
Save