diff --git a/0001-TST-Ensure-Matplotlib-is-always-cleaned-up.patch b/0001-TST-Ensure-Matplotlib-is-always-cleaned-up.patch new file mode 100644 index 0000000000000000000000000000000000000000..c74b88c122a5bbc6e70209e694e73dd72d833d36 --- /dev/null +++ b/0001-TST-Ensure-Matplotlib-is-always-cleaned-up.patch @@ -0,0 +1,157 @@ +From dc3ad727ff8eb90e7313766cced271faa0f7353d Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Mon, 12 Feb 2024 19:36:32 -0500 +Subject: [PATCH 1/6] TST: Ensure Matplotlib is always cleaned up + +The seaborn test also uses Matplotlib but was not wrapped in the cleanup +fixture, As there are now 3 files that need this fixture, refactor to +reduce code duplication. + +Signed-off-by: Elliott Sales de Andrade +--- + pandas/conftest.py | 34 +++++++++++++++++++ + .../tests/io/formats/style/test_matplotlib.py | 21 +----------- + pandas/tests/plotting/conftest.py | 21 ++---------- + pandas/tests/test_downstream.py | 2 +- + 4 files changed, 38 insertions(+), 40 deletions(-) + +diff --git a/pandas/conftest.py b/pandas/conftest.py +index 7c35dfdde9..2d37e3f843 100644 +--- a/pandas/conftest.py ++++ b/pandas/conftest.py +@@ -28,6 +28,7 @@ from datetime import ( + timezone, + ) + from decimal import Decimal ++import gc + import operator + import os + from typing import ( +@@ -1809,6 +1810,39 @@ def ip(): + return InteractiveShell(config=c) + + ++@pytest.fixture ++def mpl_cleanup(): ++ """ ++ Ensure Matplotlib is cleaned up around a test. ++ ++ Before a test is run: ++ ++ 1) Set the backend to "template" to avoid requiring a GUI. ++ ++ After a test is run: ++ ++ 1) Reset units registry ++ 2) Reset rc_context ++ 3) Close all figures ++ ++ See matplotlib/testing/decorators.py#L24. ++ """ ++ mpl = pytest.importorskip("matplotlib") ++ mpl_units = pytest.importorskip("matplotlib.units") ++ plt = pytest.importorskip("matplotlib.pyplot") ++ orig_units_registry = mpl_units.registry.copy() ++ try: ++ with mpl.rc_context(): ++ mpl.use("template") ++ yield ++ finally: ++ mpl_units.registry.clear() ++ mpl_units.registry.update(orig_units_registry) ++ plt.close("all") ++ # https://matplotlib.org/stable/users/prev_whats_new/whats_new_3.6.0.html#garbage-collection-is-no-longer-run-on-figure-close # noqa: E501 ++ gc.collect(1) ++ ++ + @pytest.fixture(params=["bsr", "coo", "csc", "csr", "dia", "dok", "lil"]) + def spmatrix(request): + """ +diff --git a/pandas/tests/io/formats/style/test_matplotlib.py b/pandas/tests/io/formats/style/test_matplotlib.py +index fb7a77f1dd..aacab81032 100644 +--- a/pandas/tests/io/formats/style/test_matplotlib.py ++++ b/pandas/tests/io/formats/style/test_matplotlib.py +@@ -1,5 +1,3 @@ +-import gc +- + import numpy as np + import pytest + +@@ -17,24 +15,7 @@ import matplotlib as mpl + from pandas.io.formats.style import Styler + + +-@pytest.fixture(autouse=True) +-def mpl_cleanup(): +- # matplotlib/testing/decorators.py#L24 +- # 1) Resets units registry +- # 2) Resets rc_context +- # 3) Closes all figures +- mpl = pytest.importorskip("matplotlib") +- mpl_units = pytest.importorskip("matplotlib.units") +- plt = pytest.importorskip("matplotlib.pyplot") +- orig_units_registry = mpl_units.registry.copy() +- with mpl.rc_context(): +- mpl.use("template") +- yield +- mpl_units.registry.clear() +- mpl_units.registry.update(orig_units_registry) +- plt.close("all") +- # https://matplotlib.org/stable/users/prev_whats_new/whats_new_3.6.0.html#garbage-collection-is-no-longer-run-on-figure-close # noqa: E501 +- gc.collect(1) ++pytestmark = pytest.mark.usefixtures("mpl_cleanup") + + + @pytest.fixture +diff --git a/pandas/tests/plotting/conftest.py b/pandas/tests/plotting/conftest.py +index d688bbd475..eb5a1f1f63 100644 +--- a/pandas/tests/plotting/conftest.py ++++ b/pandas/tests/plotting/conftest.py +@@ -1,5 +1,3 @@ +-import gc +- + import numpy as np + import pytest + +@@ -10,23 +8,8 @@ from pandas import ( + + + @pytest.fixture(autouse=True) +-def mpl_cleanup(): +- # matplotlib/testing/decorators.py#L24 +- # 1) Resets units registry +- # 2) Resets rc_context +- # 3) Closes all figures +- mpl = pytest.importorskip("matplotlib") +- mpl_units = pytest.importorskip("matplotlib.units") +- plt = pytest.importorskip("matplotlib.pyplot") +- orig_units_registry = mpl_units.registry.copy() +- with mpl.rc_context(): +- mpl.use("template") +- yield +- mpl_units.registry.clear() +- mpl_units.registry.update(orig_units_registry) +- plt.close("all") +- # https://matplotlib.org/stable/users/prev_whats_new/whats_new_3.6.0.html#garbage-collection-is-no-longer-run-on-figure-close # noqa: E501 +- gc.collect(1) ++def autouse_mpl_cleanup(mpl_cleanup): ++ pass + + + @pytest.fixture +diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py +index 51ce73ef54..bc8af95766 100644 +--- a/pandas/tests/test_downstream.py ++++ b/pandas/tests/test_downstream.py +@@ -153,7 +153,7 @@ def test_scikit_learn(): + clf.predict(digits.data[-1:]) + + +-def test_seaborn(): ++def test_seaborn(mpl_cleanup): + seaborn = pytest.importorskip("seaborn") + tips = DataFrame( + {"day": pd.date_range("2023", freq="D", periods=5), "total_bill": range(5)} +-- +2.43.0 + diff --git a/0002-Fix-evaluations-on-Python-3.12.patch b/0002-Fix-evaluations-on-Python-3.12.patch new file mode 100644 index 0000000000000000000000000000000000000000..3d035a340aabbf86e4c408dec8727d9d432bf2a6 --- /dev/null +++ b/0002-Fix-evaluations-on-Python-3.12.patch @@ -0,0 +1,67 @@ +From 76aaa36bfaa7a22cfc2fe49e59400873c0c2c3e2 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Mon, 12 Feb 2024 19:47:57 -0500 +Subject: [PATCH 2/6] Fix evaluations on Python 3.12 + +List comprehensions no longer get their own scope [1], so adding a level +to the (eventual) call to `sys._getframe` goes outside the actual +caller. If running in `pytest` (so that there is a scope outside the +caller), you end up looking in some unrelated scope. If you are running +a script, then `sys._getframe` raises an error that the level is out of +bounds. + +The `Bitwise operations` warning in `test_scalar_unary` appears to +always be raised, so remove the condition. + +[1] https://docs.python.org/3.12/whatsnew/3.12.html#whatsnew312-pep709 + +Signed-off-by: Elliott Sales de Andrade +--- + pandas/io/pytables.py | 7 ++++++- + pandas/tests/computation/test_eval.py | 4 +--- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py +index 1139519d2b..b3ed92a725 100644 +--- a/pandas/io/pytables.py ++++ b/pandas/io/pytables.py +@@ -40,6 +40,7 @@ from pandas._libs import ( + ) + from pandas._libs.lib import is_string_array + from pandas._libs.tslibs import timezones ++from pandas.compat import PY312 + from pandas.compat._optional import import_optional_dependency + from pandas.compat.pickle_compat import patch_pickle + from pandas.errors import ( +@@ -178,8 +179,12 @@ def _ensure_term(where, scope_level: int): + # list + level = scope_level + 1 + if isinstance(where, (list, tuple)): ++ # Python 3.12 does not a scope for list comprehensions, but older versions did: ++ # https://docs.python.org/3.12/whatsnew/3.12.html#whatsnew312-pep709 ++ if not PY312: ++ level += 1 + where = [ +- Term(term, scope_level=level + 1) if maybe_expression(term) else term ++ Term(term, scope_level=level) if maybe_expression(term) else term + for term in where + if term is not None + ] +diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py +index 17630f14b0..eab14c3fcd 100644 +--- a/pandas/tests/computation/test_eval.py ++++ b/pandas/tests/computation/test_eval.py +@@ -557,9 +557,7 @@ class TestEval: + + def test_scalar_unary(self, engine, parser): + msg = "bad operand type for unary ~: 'float'" +- warn = None +- if PY312 and not (engine == "numexpr" and parser == "pandas"): +- warn = DeprecationWarning ++ warn = DeprecationWarning if PY312 else None + with pytest.raises(TypeError, match=msg): + pd.eval("~1.0", engine=engine, parser=parser) + +-- +2.43.0 + diff --git a/0003-TST-Fix-IntervalIndex-constructor-tests-on-big-endia.patch b/0003-TST-Fix-IntervalIndex-constructor-tests-on-big-endia.patch new file mode 100644 index 0000000000000000000000000000000000000000..7f81415ee3e9cbad3f898cecd19e143fedaa9113 --- /dev/null +++ b/0003-TST-Fix-IntervalIndex-constructor-tests-on-big-endia.patch @@ -0,0 +1,37 @@ +From 607aa65e82e0fae1e9e4666206f746d7ffc1a3b7 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Mon, 12 Feb 2024 22:39:36 -0500 +Subject: [PATCH 3/6] TST: Fix IntervalIndex constructor tests on big-endian + systems + +Two tests cases specify the expected data to be little-endian. However, +none of the other cases do so, and the test creates native endian data, +causing these tests to fail only in these specific cases. + +Signed-off-by: Elliott Sales de Andrade +--- + pandas/tests/indexes/interval/test_constructors.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pandas/tests/indexes/interval/test_constructors.py b/pandas/tests/indexes/interval/test_constructors.py +index e47a014f18..28a6ac4c6d 100644 +--- a/pandas/tests/indexes/interval/test_constructors.py ++++ b/pandas/tests/indexes/interval/test_constructors.py +@@ -44,12 +44,12 @@ class ConstructorTests: + (Index(np.arange(-10, 11, dtype=np.int64)), np.int64), + (Index(np.arange(10, 31, dtype=np.uint64)), np.uint64), + (Index(np.arange(20, 30, 0.5), dtype=np.float64), np.float64), +- (date_range("20180101", periods=10), " +Date: Mon, 12 Feb 2024 23:34:02 -0500 +Subject: [PATCH 4/6] TST: Fix test_str_encode on big endian machines + +I couldn't find a way to specify the endianness when creating the +`ArrowDtype`, so just pick the right result based on native byte order. + +Signed-off-by: Elliott Sales de Andrade +--- + pandas/tests/extension/test_arrow.py | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/pandas/tests/extension/test_arrow.py b/pandas/tests/extension/test_arrow.py +index d9a3033b83..c551fff040 100644 +--- a/pandas/tests/extension/test_arrow.py ++++ b/pandas/tests/extension/test_arrow.py +@@ -26,6 +26,7 @@ from io import ( + import operator + import pickle + import re ++import sys + + import numpy as np + import pytest +@@ -2106,14 +2107,21 @@ def test_str_removeprefix(val): + @pytest.mark.parametrize( + "encoding, exp", + [ +- ["utf8", b"abc"], +- ["utf32", b"\xff\xfe\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00"], ++ ("utf8", {"little": b"abc", "big": "abc"}), ++ ( ++ "utf32", ++ { ++ "little": b"\xff\xfe\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00", ++ "big": b"\x00\x00\xfe\xff\x00\x00\x00a\x00\x00\x00b\x00\x00\x00c", ++ }, ++ ), + ], ++ ids=["utf8", "utf32"], + ) + def test_str_encode(errors, encoding, exp): + ser = pd.Series(["abc", None], dtype=ArrowDtype(pa.string())) + result = ser.str.encode(encoding, errors) +- expected = pd.Series([exp, None], dtype=ArrowDtype(pa.binary())) ++ expected = pd.Series([exp[sys.byteorder], None], dtype=ArrowDtype(pa.binary())) + tm.assert_series_equal(result, expected) + + +-- +2.43.0 + diff --git a/0005-TST-Add-missing-skips-for-unavailable-pyarrow.patch b/0005-TST-Add-missing-skips-for-unavailable-pyarrow.patch new file mode 100644 index 0000000000000000000000000000000000000000..f3c78cc6f766499ec3b863bbf3189938ab04e2a4 --- /dev/null +++ b/0005-TST-Add-missing-skips-for-unavailable-pyarrow.patch @@ -0,0 +1,74 @@ +From b022df8968b889c8f55832a909c602840cfe1840 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Tue, 13 Feb 2024 02:20:43 -0500 +Subject: [PATCH 5/6] TST: Add missing skips for unavailable pyarrow + +The `all_parsers` fixture has this check, but some of the other fixtures +were missing it. + +Signed-off-by: Elliott Sales de Andrade +--- + pandas/core/arrays/arrow/accessors.py | 2 +- + pandas/tests/io/formats/style/test_bar.py | 3 +++ + pandas/tests/io/parser/conftest.py | 4 ++++ + 3 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/pandas/core/arrays/arrow/accessors.py b/pandas/core/arrays/arrow/accessors.py +index 124f8fb6ad..3175781e53 100644 +--- a/pandas/core/arrays/arrow/accessors.py ++++ b/pandas/core/arrays/arrow/accessors.py +@@ -46,7 +46,7 @@ class ArrowAccessor(metaclass=ABCMeta): + + def _validate(self, data): + dtype = data.dtype +- if not isinstance(dtype, ArrowDtype): ++ if not pa_version_under10p1 and not isinstance(dtype, ArrowDtype): + # Raise AttributeError so that inspect can handle non-struct Series. + raise AttributeError(self._validation_msg.format(dtype=dtype)) + +diff --git a/pandas/tests/io/formats/style/test_bar.py b/pandas/tests/io/formats/style/test_bar.py +index b0e4712e8b..41206da56e 100644 +--- a/pandas/tests/io/formats/style/test_bar.py ++++ b/pandas/tests/io/formats/style/test_bar.py +@@ -3,6 +3,8 @@ import io + import numpy as np + import pytest + ++from pandas.compat._optional import VERSIONS ++ + from pandas import ( + NA, + DataFrame, +@@ -347,6 +349,7 @@ def test_styler_bar_with_NA_values(): + + + def test_style_bar_with_pyarrow_NA_values(): ++ pytest.importorskip("pyarrow", VERSIONS["pyarrow"]) + data = """name,age,test1,test2,teacher + Adam,15,95.0,80,Ashby + Bob,16,81.0,82,Ashby +diff --git a/pandas/tests/io/parser/conftest.py b/pandas/tests/io/parser/conftest.py +index 6d5f870f07..88ccf5fee8 100644 +--- a/pandas/tests/io/parser/conftest.py ++++ b/pandas/tests/io/parser/conftest.py +@@ -165,6 +165,7 @@ def pyarrow_parser_only(request): + """ + Fixture all of the CSV parsers using the Pyarrow engine. + """ ++ pytest.importorskip("pyarrow", VERSIONS["pyarrow"]) + return request.param() + + +@@ -198,6 +199,9 @@ def all_parsers_all_precisions(request): + Fixture for all allowable combinations of parser + and float precision + """ ++ parser = request.param[0] ++ if parser.engine == "pyarrow": ++ pytest.importorskip("pyarrow", VERSIONS["pyarrow"]) + return request.param + + +-- +2.43.0 + diff --git a/0006-Fix-accidental-loss-of-precision-for-to_datetime-str.patch b/0006-Fix-accidental-loss-of-precision-for-to_datetime-str.patch new file mode 100644 index 0000000000000000000000000000000000000000..bad935761c406dcebcad28c509964cb290a3811e --- /dev/null +++ b/0006-Fix-accidental-loss-of-precision-for-to_datetime-str.patch @@ -0,0 +1,61 @@ +From cbf5299a065e20a5b129ad5eed6953262ce54f37 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Wed, 21 Feb 2024 06:55:19 -0500 +Subject: [PATCH 6/6] Fix accidental loss-of-precision for to_datetime(str, + unit=...) + +In Pandas 1.5.3, the `float(val)` cast was inline to the +`cast_from_unit` call in `array_with_unit_to_datetime`. This caused the +intermediate (unnamed) value to be a Python float. + +Since #50301, a temporary variable was added to avoid multiple casts, +but with explicit type `cdef float`, which defines a _Cython_ float. +This type is 32-bit, and causes a loss of precision, and a regression in +parsing from 1.5.3. + +So widen the explicit type of the temporary `fval` variable to (64-bit) +`double`, which will not lose precision. + +Fixes #57051 + +Signed-off-by: Elliott Sales de Andrade +--- + pandas/_libs/tslib.pyx | 2 +- + pandas/tests/tools/test_to_datetime.py | 8 ++++++++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/pandas/_libs/tslib.pyx b/pandas/_libs/tslib.pyx +index 017fdc4bc8..dd23c2f27c 100644 +--- a/pandas/_libs/tslib.pyx ++++ b/pandas/_libs/tslib.pyx +@@ -277,7 +277,7 @@ def array_with_unit_to_datetime( + bint is_raise = errors == "raise" + ndarray[int64_t] iresult + tzinfo tz = None +- float fval ++ double fval + + assert is_ignore or is_coerce or is_raise + +diff --git a/pandas/tests/tools/test_to_datetime.py b/pandas/tests/tools/test_to_datetime.py +index 6791ac0340..a4194dcff2 100644 +--- a/pandas/tests/tools/test_to_datetime.py ++++ b/pandas/tests/tools/test_to_datetime.py +@@ -1912,6 +1912,14 @@ class TestToDatetimeUnit: + with pytest.raises(ValueError, match=msg): + to_datetime([1], unit="D", format="%Y%m%d", cache=cache) + ++ def test_unit_str(self, cache): ++ # GH 57051 ++ # Test that strs aren't dropping precision to 32-bit accidentally. ++ with tm.assert_produces_warning(FutureWarning): ++ res = pd.to_datetime(["1704660000"], unit="s", origin="unix") ++ expected = pd.to_datetime([1704660000], unit="s", origin="unix") ++ tm.assert_index_equal(res, expected) ++ + def test_unit_array_mixed_nans(self, cache): + values = [11111111111111111, 1, 1.0, iNaT, NaT, np.nan, "NaT", ""] + result = to_datetime(values, unit="D", errors="ignore", cache=cache) +-- +2.43.0 + diff --git a/0007-Fix-Python-3.13-test-failures.patch b/0007-Fix-Python-3.13-test-failures.patch new file mode 100644 index 0000000000000000000000000000000000000000..49a781db2bee4a15bb85e651664d27429ba2d7d9 --- /dev/null +++ b/0007-Fix-Python-3.13-test-failures.patch @@ -0,0 +1,126 @@ +From 9e68917ce80372791cc3e852032b039fd341c428 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 25 Jun 2024 18:51:29 -0600 +Subject: [PATCH 7/7] Fix Python 3.13 test failures + +--- + pandas/_libs/src/vendored/ujson/python/objToJSON.c | 12 ++++++------ + pandas/_libs/tslibs/offsets.pyx | 7 ++++++- + pandas/tests/io/parser/test_dialect.py | 2 +- + pandas/tests/io/test_common.py | 5 ++++- + pandas/tests/io/xml/test_xml.py | 2 +- + pandas/tests/scalar/timedelta/test_arithmetic.py | 1 + + 6 files changed, 19 insertions(+), 10 deletions(-) + +diff --git a/pandas/_libs/src/vendored/ujson/python/objToJSON.c b/pandas/_libs/src/vendored/ujson/python/objToJSON.c +index 74ca8ea..6ee2f82 100644 +--- a/pandas/_libs/src/vendored/ujson/python/objToJSON.c ++++ b/pandas/_libs/src/vendored/ujson/python/objToJSON.c +@@ -412,8 +412,8 @@ static void NpyArr_iterBegin(JSOBJ _obj, JSONTypeContext *tc) { + npyarr->type_num = PyArray_DESCR(obj)->type_num; + + if (GET_TC(tc)->transpose) { +- npyarr->dim = PyArray_DIM(obj, npyarr->ndim); +- npyarr->stride = PyArray_STRIDE(obj, npyarr->ndim); ++ npyarr->dim = PyArray_DIM(obj, (int)npyarr->ndim); ++ npyarr->stride = PyArray_STRIDE(obj, (int)npyarr->ndim); + npyarr->stridedim = npyarr->ndim; + npyarr->index[npyarr->ndim] = 0; + npyarr->inc = -1; +@@ -454,8 +454,8 @@ static void NpyArrPassThru_iterEnd(JSOBJ obj, JSONTypeContext *tc) { + return; + } + const PyArrayObject *arrayobj = (const PyArrayObject *)npyarr->array; +- npyarr->dim = PyArray_DIM(arrayobj, npyarr->stridedim); +- npyarr->stride = PyArray_STRIDE(arrayobj, npyarr->stridedim); ++ npyarr->dim = PyArray_DIM(arrayobj, (int)npyarr->stridedim); ++ npyarr->stride = PyArray_STRIDE(arrayobj, (int)npyarr->stridedim); + npyarr->dataptr += npyarr->stride; + + NpyArr_freeItemValue(obj, tc); +@@ -526,8 +526,8 @@ static int NpyArr_iterNext(JSOBJ _obj, JSONTypeContext *tc) { + } + const PyArrayObject *arrayobj = (const PyArrayObject *)npyarr->array; + +- npyarr->dim = PyArray_DIM(arrayobj, npyarr->stridedim); +- npyarr->stride = PyArray_STRIDE(arrayobj, npyarr->stridedim); ++ npyarr->dim = PyArray_DIM(arrayobj, (int)npyarr->stridedim); ++ npyarr->stride = PyArray_STRIDE(arrayobj, (int)npyarr->stridedim); + npyarr->index[npyarr->stridedim] = 0; + + ((PyObjectEncoder *)tc->encoder)->npyCtxtPassthru = npyarr; +diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx +index c37a4b2..5dacd7d 100644 +--- a/pandas/_libs/tslibs/offsets.pyx ++++ b/pandas/_libs/tslibs/offsets.pyx +@@ -4960,7 +4960,12 @@ cpdef to_offset(freq, bint is_period=False): + if result is None: + raise ValueError(INVALID_FREQ_ERR_MSG.format(freq)) + +- if is_period and not hasattr(result, "_period_dtype_code"): ++ try: ++ has_period_dtype_code = hasattr(result, "_period_dtype_code") ++ except ValueError: ++ has_period_dtype_code = False ++ ++ if is_period and not has_period_dtype_code: + if isinstance(freq, str): + raise ValueError(f"{result.name} is not supported as period frequency") + else: +diff --git a/pandas/tests/io/parser/test_dialect.py b/pandas/tests/io/parser/test_dialect.py +index 7a72e66..8031147 100644 +--- a/pandas/tests/io/parser/test_dialect.py ++++ b/pandas/tests/io/parser/test_dialect.py +@@ -26,7 +26,7 @@ def custom_dialect(): + "escapechar": "~", + "delimiter": ":", + "skipinitialspace": False, +- "quotechar": "~", ++ "quotechar": "`", + "quoting": 3, + } + return dialect_name, dialect_kwargs +diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py +index 0740338..e51f865 100644 +--- a/pandas/tests/io/test_common.py ++++ b/pandas/tests/io/test_common.py +@@ -485,7 +485,10 @@ class TestMMapWrapper: + df.to_csv(path, compression=compression_, encoding=encoding) + + # reading should fail (otherwise we wouldn't need the warning) +- msg = r"UTF-\d+ stream does not start with BOM" ++ msg = ( ++ r"UTF-\d+ stream does not start with BOM|" ++ r"'utf-\d+' codec can't decode byte" ++ ) + with pytest.raises(UnicodeError, match=msg): + pd.read_csv(path, compression=compression_, encoding=encoding) + +diff --git a/pandas/tests/io/xml/test_xml.py b/pandas/tests/io/xml/test_xml.py +index 6f429c1..900734e 100644 +--- a/pandas/tests/io/xml/test_xml.py ++++ b/pandas/tests/io/xml/test_xml.py +@@ -1044,7 +1044,7 @@ def test_utf16_encoding(xml_baby_names, parser): + UnicodeError, + match=( + "UTF-16 stream does not start with BOM|" +- "'utf-16-le' codec can't decode byte" ++ "'utf-16(-le)?' codec can't decode byte" + ), + ): + read_xml(xml_baby_names, encoding="UTF-16", parser=parser) +diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py +index d2fa0f7..33ac121 100644 +--- a/pandas/tests/scalar/timedelta/test_arithmetic.py ++++ b/pandas/tests/scalar/timedelta/test_arithmetic.py +@@ -622,6 +622,7 @@ class TestTimedeltaMultiplicationDivision: + [ + r"Invalid dtype datetime64\[D\] for __floordiv__", + "'dtype' is an invalid keyword argument for this function", ++ "this function got an unexpected keyword argument 'dtype'", + r"ufunc '?floor_divide'? cannot use operands with types", + ] + ) +-- +2.45.2 + diff --git a/pandas-2.2.1.tar.gz b/pandas-2.2.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..2384d01721f9ee1317ed0b9f2656a0ec248b3455 Binary files /dev/null and b/pandas-2.2.1.tar.gz differ diff --git a/python-pandas.spec b/python-pandas.spec index 2b52d456b2bad4812aa0ee8402a6874c9d75c506..c39c33e1ca30024206cbfbd046902ca5397f1ba5 100644 --- a/python-pandas.spec +++ b/python-pandas.spec @@ -1,4 +1,4 @@ -%define anolis_release 3 +%define anolis_release 1 # We need to break some cycles with optional dependencies for bootstrapping; # given that a conditional is needed, we take the opportunity to omit as many # optional dependencies as possible for bootstrapping. @@ -13,7 +13,7 @@ %bcond_without single_tests Name: python-pandas -Version: 1.5.3 +Version: 2.2.1 Release: %{anolis_release}%{?dist} Summary: Python library providing high-performance data analysis tools @@ -72,8 +72,15 @@ Summary: Python library providing high-performance data analysis tools # - scripts/no_bool_in_generic.py is MIT: see LICENSES/PYUPGRADE_LICENSE License: BSD-3-Clause AND (Apache-2.0 OR BSD-2-Clause) AND (BSD-3-Clause AND Apache-2.0) AND (BSD-3-Clause AND MIT) AND (BSD-3-Clause AND Python-2.0.1) AND MIT AND (BSD-3-Clause AND BSD-2-Clause) URL: https://pandas.pydata.org/ +Source0: https://github.com/pandas-dev/pandas/archive/v2.2.1/pandas-2.2.1.tar.gz # The GitHub archive contains tests; the PyPI sdist does not. -Source0: https://github.com/pandas-dev/pandas/archive/v%{version}/pandas-%{version}.tar.gz +Patch1: 0004-TST-Fix-test_str_encode-on-big-endian-machines.patch +Patch2: 0007-Fix-Python-3.13-test-failures.patch +Patch3: 0002-Fix-evaluations-on-Python-3.12.patch +Patch4: 0003-TST-Fix-IntervalIndex-constructor-tests-on-big-endia.patch +Patch5: 0001-TST-Ensure-Matplotlib-is-always-cleaned-up.patch +Patch6: 0006-Fix-accidental-loss-of-precision-for-to_datetime-str.patch +Patch7: 0005-TST-Add-missing-skips-for-unavailable-pyarrow.patch # Fix some little-endian assumptions in the tests # https://github.com/pandas-dev/pandas/pull/49913 @@ -471,6 +478,9 @@ Recommends: python3dist(cftime) # environment.yml: optional BuildRequires: python3dist(ipython) >= 7.11.1 +BuildRequires: python3dist(numpy) >= 1.26 +BuildRequires: python3dist(python-dateutil) >= 2.8.2 +BuildRequires: python3dist(pytz) >= 2020.1 Recommends: python3dist(ipython) >= 7.11.1 # pandas/tests/io/data/spss/*.sav: @@ -636,6 +646,16 @@ export PYTHONHASHSEED="$( %changelog +* Thu Dec 04 2025 wency_cn - 2.2.1-1 +- Updated to version 2.2.1 to fix xxxxxx +- Fix test failures on big-endian machines by using correct byte order for UTF-32 encoding. +- Ensure compatibility with Python 3.13 by fixing test failures and preventing runtime errors. +- Fix scope handling in Python 3.12 to prevent frame access errors and ensure correct evaluation behavior. +- Fix test failures on big-endian systems by removing platform-specific byte order assumptions. +- Eliminate code duplication, ensure test isolation, and prevent resource leaks by centralizing Matplotlib cleanup. +- Prevent loss of precision in timestamp parsing by ensuring 64-bit floating-point accuracy. +- Ensure tests skip gracefully when PyArrow is unavailable or outdated. + * Thu Jul 25 2024 Wenlong Zhang - 1.5.3-3 - rebuild for loongarch64