@@ -5379,7 +5379,6 @@ class TestScalarPickle:
53795379
53805380 @pytest .mark .parametrize ("backend" , ["sleef" , "longdouble" ])
53815381 def test_pickle_scalar_issue_repro (self , backend ):
5382- """The exact repro from #99: was RuntimeError on loads()."""
53835382 import pickle
53845383 original = QuadPrecision ("123.456" , backend = backend )
53855384 loaded = pickle .loads (pickle .dumps (original ))
@@ -5402,9 +5401,7 @@ def test_pickle_scalar_finite_roundtrip(self, backend, value):
54025401 loaded = pickle .loads (pickle .dumps (original ))
54035402 assert isinstance (loaded , QuadPrecision )
54045403 assert loaded .dtype == QuadPrecDType (backend = backend )
5405- # Exact equality: pickle/unpickle should not lose any bits.
54065404 assert loaded == original
5407- # And the canonical repr should match.
54085405 assert str (loaded ) == str (original )
54095406
54105407 @pytest .mark .parametrize ("backend" , ["sleef" , "longdouble" ])
@@ -5414,7 +5411,7 @@ def test_pickle_scalar_inf(self, backend):
54145411 original = QuadPrecision (s , backend = backend )
54155412 loaded = pickle .loads (pickle .dumps (original ))
54165413 assert isinstance (loaded , QuadPrecision )
5417- assert loaded == original # inf == inf, -inf == -inf
5414+ assert loaded == original
54185415 assert float (loaded ) == float (original )
54195416
54205417 @pytest .mark .parametrize ("backend" , ["sleef" , "longdouble" ])
@@ -5423,7 +5420,6 @@ def test_pickle_scalar_nan(self, backend):
54235420 original = QuadPrecision ("nan" , backend = backend )
54245421 loaded = pickle .loads (pickle .dumps (original ))
54255422 assert isinstance (loaded , QuadPrecision )
5426- # NaN != NaN, so we check isnan instead.
54275423 import math
54285424 assert math .isnan (float (loaded ))
54295425 assert loaded .dtype == QuadPrecDType (backend = backend )
@@ -5447,13 +5443,9 @@ def test_pickle_scalar_preserves_type(self):
54475443
54485444 @pytest .mark .parametrize ("backend" , ["sleef" , "longdouble" ])
54495445 def test_pickle_scalar_preserves_full_precision (self , backend ):
5450- """Diagnostic precision-loss test. Two values with the same printed
5451- repr can still differ at the full bit width, so check via subtraction
5452- (which preserves precision) — `loaded - original` must be exactly zero.
5453- Catches the regression where the longdouble path went through (double)."""
5446+ """Compare via subtraction, not repr: two values with the same printed
5447+ repr can still differ at the full bit width."""
54545448 import pickle
5455- # A value with more than 16 significant digits — exercises precision
5456- # beyond what double can represent.
54575449 original = QuadPrecision ("3.14159265358979323846264338327950288" ,
54585450 backend = backend )
54595451 loaded = pickle .loads (pickle .dumps (original ))
@@ -5487,16 +5479,6 @@ def test_pickle_scalar_in_list(self):
54875479 assert math .isnan (float (loaded [2 ]))
54885480 assert loaded [3 ] == original [3 ]
54895481
5490- @pytest .mark .parametrize ("backend" , ["sleef" , "longdouble" ])
5491- def test_pickle_scalar_loads_does_not_raise (self , backend ):
5492- """Direct regression on the exact failure mode in the bug report
5493- (RuntimeError from numpy's legacy SETITEM path)."""
5494- import pickle
5495- try :
5496- pickle .loads (pickle .dumps (QuadPrecision ("123.456" , backend = backend )))
5497- except RuntimeError as exc :
5498- pytest .fail (f"pickle.loads raised RuntimeError: { exc } " )
5499-
55005482
55015483@pytest .mark .parametrize ("dtype" , [
55025484 "bool" ,
0 commit comments