Escape-baseline keys are fragile across Python versions (comprehension frame names, PEP 709)
- Dominant language
- Python
- Stars
- 93
- Forks
- 92
- Avg merge
- 14h 44m
- Merged PRs (30d)
- 30
Description
Follow-up from PR #942 (review item P2, https://github.com/astropy/ccdproc/pull/942#pullrequestreview-4695447403).
Baseline keys in `ccdproc/tests/array_escape_baseline.txt` include the frame *function name* of the escape site. Those names are not stable across Python versions:
- List comprehensions have their own frame named `` on Python < 3.12, but are inlined into the enclosing function on 3.12+ (PEP 709), so the same escape keys differently depending on the interpreter.
- Generator expressions and lambdas key as `` / `` on all versions, which are ambiguous within a file.
The enforce CI job (`py312-alldeps-dask-enforce`) runs on Python 3.12, so a contributor who regenerates the baseline with `CCDPROC_WRITE_ESCAPE_BASELINE=1` on Python 3.11 produces mismatched keys: CI then reports spurious NEW-escape failures (the 3.12 spelling is missing) plus spurious stale entries (the 3.11 spelling is never observed).
Fix options:
1. Normalize comprehension-style frame names (``, ``, ``, and possibly ``/``) to the enclosing function's name when recording escape sites, so keys match across versions; or
2. Document a Python floor (>= 3.12) for baseline regeneration in `docs/array_api.rst` and in the baseline file header, and optionally have write mode refuse to run on older interpreters.
Contributor guide
Research direction
Start with PR #942's review item and ccdproc/tests/array_escape_baseline.txt, then inspect the escape-site recording used by CCDPROC_WRITE_ESCAPE_BASELINE=1. Compare behavior on Python 3.11 and 3.12, including the enforce CI job. Done means baseline keys are stable across supported versions, or the Python floor and write-mode restriction are documented in docs/array_api.rst and the baseline header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ci-cd, documentation, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100