Skip to content

Commit 6ca7598

Browse files
sbryngelsonclaude
andcommitted
Use has_bad_values() for restart check (catches NaN + Inf)
Replace has_NaNs() with the existing has_bad_values() method which checks for both NaN and Inf, matching the straight-run check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ee65c7b commit 6ca7598

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

toolchain/mfc/packer/pack.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ def find(self, filepath: str) -> PackEntry:
4040
def set(self, entry: PackEntry):
4141
self.entries[entry.filepath] = entry
4242

43-
def has_NaNs(self) -> bool:
44-
"""Return True if any entry contains NaN values."""
45-
import math
46-
47-
return any(math.isnan(d) for e in self.entries.values() for d in e.doubles)
48-
4943
def remove(self, filepath_or_entry: typing.Union[str, PackEntry]):
5044
if isinstance(filepath_or_entry, str):
5145
del self.entries[filepath_or_entry]

toolchain/mfc/test/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ def _handle_case(case: TestCase, devices: typing.Set[int]):
445445
if restart_err is not None:
446446
raise MFCException(f"Test {case}: Restart pack error: {restart_err}")
447447

448-
if restart_pack.has_NaNs():
449-
raise MFCException(f"Test {case}: NaNs detected in restarted output.")
448+
if restart_pack.has_bad_values():
449+
raise MFCException(f"Test {case}: NaN or Inf detected in restarted output.")
450450

451451
_, restart_msg = packtol.compare(restart_pack, straight_pack, packtol.Tolerance(tol, tol))
452452
if restart_msg is not None:

0 commit comments

Comments
 (0)