◐ Shell
clean mode source ↗

[DO NOT MERGE] Test no mention-bot by dstufft · Pull Request #368 · python/cpython

@dstufft

jaraco pushed a commit that referenced this pull request

Dec 2, 2022

SonicField added a commit to SonicField/cpython that referenced this pull request

May 13, 2026
…zeof

Closes c14 latent silent-break gap per supervisor 00:51:18Z (A) +
pythia python#368 missing-validation flag.

c14 (0703dba) phx_frame_header_size hardcodes sizeof(void*) for the
FrameHeader argument to jit_frame_header_size, matching C++ frameHeaderSize
semantics (frame_header.h:67). The hardcoded value is documented as "On
3.12+, FrameHeader = union { PyFunctionObject*; uintptr_t rtfs; } =
sizeof(void*)" — comment-derived, NOT static_asserted.

If the FrameHeader union grows in a future Python version (or even on
3.12.X minor revisions adding fields), the hardcoded sizeof(void*)
silently produces wrong offsets at runtime, re-creating the c14 SIGSEGV
class with no compile-time signal.

This commit adds a static_assert guard in hir_instr_c_verify.cpp:

  #if PY_VERSION_HEX >= 0x030C0000
  static_assert(sizeof(jit::FrameHeader) == sizeof(void*), "...");
  #endif

Files:
  M Python/jit/hir/hir_instr_c_verify.cpp  (+15 LOC: include + 5-line
    static_assert with explanatory comment)

Net delta: +15 LOC.

Defensive-infra-class commit per docs/methodology/synthetic_falsifier_at_gate.md
(1546c43). Synthetic falsifier OPTIONAL given trivial scope (5-LOC
static_assert + include) per supervisor 00:51:18Z (A) — would-be falsifier
test (intentionally redefining FrameHeader to 16 bytes; verifying static
assert FIRES) is symbolic since the FrameHeader struct is defined upstream.

PRE-COMMIT BUILD VERIFIED via pre-commit hook a2e8808 — hook
re-globs .cpp file via cmake configure, compiles with new static_assert,
PASS = current FrameHeader is sizeof(void*) on this build target.

SonicField added a commit to SonicField/cpython that referenced this pull request

May 13, 2026
Authored per supervisor 00:51:18Z (B) + pythia python#368 audit-completeness
gap. Closes the chat→structural gap for the cascade-audit-3-category
discipline (feedback_cascade_audit_3category) by codifying the explicit
checklist into the corpus.

Files:
  NEW docs/methodology/pre-port-audit-checklist.md  (+118 LOC)

Specifies:
- Motivation (c14 a6500318e0 SIGSEGV: audit cited only sizeof, missed
  offsetof + literal-offset categories; +8-byte offset corruption from
  frame_asm_c_frame_header_size +sizeof(void*) asymmetry vs C++
  frameHeaderSize)
- 3 categories explicit:
  (a) Sizeof equivalence (per touched C++ struct/class)
  (b) Offsetof equivalence per accessed field (NOT optional even if
      sizeof matches — empty-base-optimization can shift offsets
      symmetrically)
  (c) Hardcoded literal-offset equivalents (verify C-side substitute
      has same semantics as C++ original; cite both file:line; identify
      asymmetries: asm-helper vs LIR-generation, version conditionals,
      arithmetic adjustments)
- Pre-audit procedure (4 steps: enumerate a, enumerate b, enumerate c,
  compose audit post)
- Pre-audit example using c14 retrospective (what the audit SHOULD have
  said — calibration anchor)
- Enforcement chain (author cite + gatekeeper APPROVE checklist + medic
  flag + supervisor dispose)
- Out-of-scope (routine, docs, test, single-language refactors)
- Non-coverage caveat (catches structural layout, NOT algorithmic
  differences / side effects / threading)
- Self-falsifying disclaimer (calibration: any audit citing 3 categories
  at this detail level that still misses c14-class bug = checklist
  incomplete, not author failure)

NOT a v2.x amendment per moratorium (D-1778554524) — operational
discipline / methodology document. Companion to
synthetic_falsifier_at_gate.md (1546c43).

PRE-COMMIT BUILD: doc-only; pre-commit hook docs-path-skip per
a2e8808 self-config.