Skip to content

Fix numeric formatting of temporal dictionary keys - #624

Open
be-student wants to merge 1 commit into
qlustered:devfrom
be-student:codex/550-datetime-key-formatting
Open

Fix numeric formatting of temporal dictionary keys#624
be-student wants to merge 1 commit into
qlustered:devfrom
be-student:codex/550-datetime-key-formatting

Conversation

@be-student

Copy link
Copy Markdown

Summary

Fix the TypeError raised when date/time objects are dictionary keys and key-cleaning options route them through numeric formatting. number_to_string() now uses the existing only_numbers group; temporal objects pass through unchanged instead of reaching round(). Broad comparison dispatch still uses the existing numbers group.

Fixes #550.

The same guard correction was proposed in the closed #599; #615 proposed an equivalent temporal early return. Both attempts were closed by their authors without a recorded maintainer rejection. This contribution revalidates the current dev branch and adds broader regression coverage.

Validation

  • All 67 new parameterized cases failed before the implementation change. They cover the exact reported API call, five temporal families, aware datetimes, both numeric notations, multiple precision settings, all three key-cleaning flags, and dictionaries inside unordered lists. Distinct temporal keys and original mappings remain intact.
  • Python 3.13 and 3.14 focused datetime/helper suites: 236 passed each.
  • Full upstream nox suite including --runslow: 1,375 passed, 8 skipped, 1 failed, 95% coverage. The unchanged test_restricted_unpickler_memory_exhaustion_cve fails at resource.setrlimit(RLIMIT_AS) on macOS, before unpickling. The same failure was reproduced on the untouched base commit using the same environment; no security test or memory-limit changes are included.
  • Pyright for deepdiff/helper.py: zero errors/warnings. CI's blocking Flake8 selection and git diff --check passed.
  • Sphinx HTML build passed; the updated numeric-formatting documentation was verified in the rendered output.

Audited callers include ordinary/grouped dictionary-key cleaning, DeepHash numeric dispatch, scalar comparison, and complex-number formatting. Existing numeric rounding, temporal comparison/truncation, and normalized key-label behavior are preserved. No persistent-data migration is needed.

AI assistance: OpenAI Codex (GPT-6), local implementation, tests, and review. Hosted Linux/Python matrix results remain pending.

Keep temporal objects out of numeric rounding at the shared formatter. Cover direct and unordered dictionary comparison, distinct temporal keys, and formatting precision while preserving numeric behavior.

Fixes: qlustered#550
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant