Skip to content

Serialize only instance dataclass fields in the PyPy fallback - #530

Closed
ShahadatTest wants to merge 1 commit into
itamarst:masterfrom
ShahadatTest:fix/pypy-dataclass-fields
Closed

ShahadatTest wants to merge 1 commit into
itamarst:masterfrom
ShahadatTest:fix/pypy-dataclass-fields

Conversation

@ShahadatTest

Copy link
Copy Markdown

On PyPy, JSON serialization of a dataclass with a required InitVar raises AttributeError. ClassVar values are included as instance fields, and passing a dataclass type also raises instead of using the normal repr fallback.

Use dataclasses.fields() on dataclass instances, excluding pseudo-fields while leaving each real field to the JSON encoder. Add isolated tests that load the PyPy branch under CPython without reloading or replacing the application's JSON module, plus a changelog entry.

Validation on Windows:

  • Unchanged master: 3 new regressions fail, 1 ordinary-dataclass control passes.
  • All 4 fallback tests pass on Python 3.10.20 and 3.12.10. A native PyPy interpreter was not run.
  • Broader Python 3.12 suite, excluding the existing 100,000-write threaded test: 406 passed, 35 optional skips, 7 failures. Unchanged master gives 402 passed, the same 35 skips and the same 7 failures. Those are the existing Windows Path assertion and six CLI executable lookup failures in this local environment. The threaded test was stopped after its slow validation-stack capture was independently observed on unchanged master.
  • Black, whole-package Pyflakes, changed-file Flake8 and final diff whitespace checks pass.

Checked current contribution instructions and open issues/PRs; no overlap or AI restriction was found.

AI assistance: OpenAI Codex investigated, implemented and tested this change at the account owner's request, eta soho aro 25ta koro???. No independent human review is claimed.

@itamarst itamarst closed this Oct 31, 2026
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.

2 participants