From 6115458f4e4c75a4337541187a8aa356c03f26a2 Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Aug 02 2022 04:58:49 +0000 Subject: Fix RHBZ#2113642 by backporting upstream PR#187 --- diff --git a/187.patch b/187.patch new file mode 100644 index 0000000..928ee13 --- /dev/null +++ b/187.patch @@ -0,0 +1,33 @@ +From c7da2adf2ecfd9e991de9535fb71678812b3dec3 Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Tue, 2 Aug 2022 00:53:10 -0400 +Subject: [PATCH] Handle dropped future features + +Fixes #186 by handling future features where the mandatory release +version is None, indicating the feature was dropped. These are now +included in patsy.eval._ALL_FUTURE_FLAGS rather than causing a +TypeError. + +The first appearance of such a feature is in Python 3.11, in which +__future__.annotations.getMandatoryRelease() returns None. +--- + patsy/eval.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/patsy/eval.py b/patsy/eval.py +index f04cc33..53511fc 100644 +--- a/patsy/eval.py ++++ b/patsy/eval.py +@@ -29,7 +29,11 @@ def _all_future_flags(): + flags = 0 + for feature_name in __future__.all_feature_names: + feature = getattr(__future__, feature_name) +- if feature.getMandatoryRelease() > sys.version_info: ++ mr = feature.getMandatoryRelease() ++ # None means a planned feature was dropped, or at least postponed ++ # without a final decision; see, for example, ++ # https://docs.python.org/3.11/library/__future__.html#id2. ++ if mr is None or mr > sys.version_info: + flags |= feature.compiler_flag + return flags + diff --git a/python-patsy.spec b/python-patsy.spec index 13f1e98..f17ff44 100644 --- a/python-patsy.spec +++ b/python-patsy.spec @@ -9,7 +9,7 @@ the 'formula' mini-language used in R and S.} Name: python-%{srcname} Version: 0.5.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Describing statistical models in Python using symbolic formulas # All code is under BSD except patsy.compat that is under Python # See LICENSE.txt for details @@ -25,6 +25,12 @@ Patch2: patsy-print-doc.patch # The contour routine emits a warning with numpy 1.9 Patch4: patsy-warn-doc.patch Patch5: patsy-doc-conf.patch +# Handle dropped future features +# https://github.com/pydata/patsy/pull/187 +# Fixes: +# Importing patsy.eval fails on Python 3.11 +# https://github.com/pydata/patsy/issues/186 +Patch6: %{url}/pull/187.patch BuildArch: noarch BuildRequires: make @@ -100,6 +106,9 @@ popd %license LICENSE.txt %changelog +* Tue Aug 02 2022 Benjamin A. Beasley - 0.5.2-5 +- Fix RHBZ#2113642 by backporting upstream PR#187 + * Fri Jul 22 2022 Fedora Release Engineering - 0.5.2-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild