Skip to content

Convert READMEs to rst#5

Closed
refi64 wants to merge 12 commits intopython:masterfrom
refi64:readme-fm
Closed

Convert READMEs to rst#5
refi64 wants to merge 12 commits intopython:masterfrom
refi64:readme-fm

Conversation

@refi64
Copy link
Copy Markdown
Contributor

@refi64 refi64 commented Feb 10, 2017

@refi64
Copy link
Copy Markdown
Contributor Author

refi64 commented Feb 10, 2017

Dammit, @Haypo beat me to it in #2. :/

@refi64 refi64 closed this Feb 10, 2017
@vstinner
Copy link
Copy Markdown
Member

My pull request is only for the README of the root directory, since this one is used by GitHub on the project home page.

I'm not sure that .rst is a common file extension on Windows, so I don't know if it's ok to rename PCbuild/README.txt.

About Doc/README, I have no opinion :-)

@refi64
Copy link
Copy Markdown
Contributor Author

refi64 commented Feb 10, 2017

@Haypo I mean, at least personally, it's not uncommon for me to leave a project repository's rst/md files open in Chrome while I work with it, since it's usually easier to read it there (with formatting) than in a basic text editor, so that was the idea behind changing PCbuild/README.txt.

native-api pushed a commit to native-api/cpython that referenced this pull request Jun 5, 2018
paulmon added a commit to paulmon/cpython that referenced this pull request Jan 10, 2019
emmatyping referenced this pull request in emmatyping/cpython Jan 31, 2020
illia-v added a commit to illia-v/cpython that referenced this pull request Jan 21, 2021
miss-islington pushed a commit that referenced this pull request Jan 22, 2021
….1 (GH-24289)

RFC 8018 superseded RFC 8018.

Automerge-Triggered-By: GH:tiran
adorilson referenced this pull request in adorilson/cpython Mar 13, 2021
….1 (pythonGH-24289)

RFC 8018 superseded RFC 8018.

Automerge-Triggered-By: GH:tiran
nanjekyejoannah added a commit to nanjekyejoannah/cpython that referenced this pull request Apr 12, 2022
5: Support Py3xwarning warnings with a fix argument r=vext01 a=nanjekyejoannah

This PR does the following:

- Adds a `fix` argument to allow for flexibility in adding a possible fix to a warning
- The new warning format is used for the already merged warnings for numbers

Co-authored-by: Joannah Nanjekye <jnanjekye@python.org>
barneygale added a commit to barneygale/cpython that referenced this pull request Oct 29, 2024
JoBeGaming added a commit to JoBeGaming/cpython that referenced this pull request Feb 23, 2026
* Added `default` parameter to `lookup_special` in `types.py`

See https://discuss.python.org/t/expose-special-method-lookup-at-python-level/106236 for more.

---------

Co-authored-by: JoBe <165585785+JoBeGaming@users.noreply.github.com>
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 6, 2026
Five bugs found and fixed in C translateMove:
1. XMM register base offset (PHYLOC_VECD_REG_BASE subtraction)
2. kOut memory sizing (output's size for memory operands)
3. isVecD (physical register location check)
4. Linked operand resolution (lir_operand_type/data_type getters)
5. XMM register size (16 for MOVQ encoder, matching C++ Xmm class)

Also: ARM64 linked operand fix (64 raw ->type_ → resolving getters)

Fingerprint shows float functions now match C++ sizes after fix python#5.
Integer functions have 3-5 byte differences (1 instruction encoding
variation). Crash persists under multi-compilation (test suite) but
individual function execution is correct.

Move enabled in dispatch for continued investigation.
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 22, 2026
…ation)

Push 39's e808676 + 0a5f096 added BINARY_MATCH on both arches.
The grep is bare-hash: 'grep "$COMMIT_HASH" "$LONG_VERSION"'. That
matches both clean ':<hash>,' AND '-dirty:<hash>' suffix — the
exact contamination class that bit catch python#4 (binary built from a
dirty working tree masquerades as a clean build).

Pre-push-39, 'cp || true' accidentally protected against this by
falling back to a stale-clean python_gate when local build was
dirty. Push 39 removed the fallback. Without -dirty rejection,
the next contaminated build IS the binary the gate tests, while
BINARY_MATCH still passes.

Fix: tighten the check to reject any version string containing
'-dirty'. Mirror on ARM64 path (mirrors 0a5f096 symmetry).
Output now distinguishes BINARY_MISMATCH (wrong hash) from
BINARY_DIRTY (right hash, dirty build).

Adds catches python#5 (push-39 in-flight commit race) and python#6 (this
fix) to docs/wiring_catches.md.

Per supervisor 2026-04-22 01:08:18Z + theologian 01:08:00Z
(defense-in-depth: when a single incident exposes N adjacent
gaps, fixing 1 leaves N-1 unprotected).
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 22, 2026
Convert HIRBuilder::emitLoadMethodOrAttrSuper from C++ multi-block
deopt+dispatch to a thin delegation stub. New C function
hir_builder_emit_load_method_or_attr_super_c builds the deopt path
(snapshot+deopt) and fast path (CondBranchCheckType + RefineType +
LoadAttrSuper or LoadMethodSuper+GetSecondOutput).

C++ stub computes nothing — passes oparg + bc_offset.value() through
to C. The C body computes name_idx/load_method/no_args from oparg
(3.11+ packing per theologian audit python#3 — load_method param overwrite),
following the project's 3.12-only convention dropping the pre-3.11
oparg-tuple branch.

Theologian invariant audit (2026-04-22 11:58:52Z) drives the
implementation:

  python#1 phx_frame_state_copy runs BEFORE the 3 pops so deopt-path frame
     preserves PRE-POP stack for interpreter resumption
  python#4 pop order: receiver (TOS), type, global_super
  python#5 push order varies by load_method (1 value vs 2)
  python#8 deopt-path emits go into deopt_tc.block
  python#9 CondBranchCheckType branches; tc.block <- fast_path; emit
     RefineType in-place

Both exit paths phx_frame_state_destroy the deopt_tc to avoid leaking
the heap-allocated stack/locals arrays.

testkeeper pre-commit verify (2026-04-22 12:15:46Z): JIT_BUILD_EXIT=0,
full BUILD_EXIT=0, 7/7 phoenix-jit tests PASS at HEAD+uncommitted.
W26 gate-hardening not triggered (no recent fail).
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 23, 2026
PRIMITIVE_UNARY_OP (Static Python) opcode handler. Per W27a Step A scope
final commit (5 of 5).

C body: hir_builder_emit_primitive_unary_op_c (~50 lines). Inlines the
PRIM_OP_* unary-op switch:
  - NEG_INT/INV_INT/NOT_INT: emit primitive_unary_op directly
  - NEG_DBL: special-case via load_const(-1.0) + double_multiply (no
    native double-negate primitive). hir_type_from_cdouble handles
    Type::fromCDouble C-side equivalent.

PHX_PRIM_UOP_* values are in a SEPARATE namespace from binary/compare
(per classloader.h:110-113 — unary uses 0..3, distinct from binary
0..23). Defined separately to avoid identifier collision.

C primitives used: hir_c_create_primitive_unary_op + hir_c_create_load_const
+ hir_c_create_double_binary_op + hir_type_from_cdouble +
hir_builder_temps_alloc_stack (all existing).

C++ HIRBuilder::emitPrimitiveUnaryOp → 4-line delegation stub (passes
current_func_ for AllocateRegister equivalent).

Verification: cmake --build target jit/phoenix_jit clean (BUILD_EXIT=0).

W27a CLOSURE: 5/5 emit-methods converted (PrimitiveBox/Unbox/BinaryOp/
Compare/UnaryOp). Pure-C++ count: 20 → 15 (5 delegation stubs added).
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 23, 2026
PRIMITIVE_LOAD_CONST (Static Python) opcode handler. Per W27b Step A scope
final commit (5 of 5).

C body: hir_builder_emit_primitive_load_const_c (~50 lines). Reads
(num, type_code) pair from co_consts[oparg], maps type_code via
hir_prim_type_to_type, builds the appropriate fromC* HirType:
  - CDouble → hir_type_from_cdouble(PyFloat_AsDouble(num))
  - CBool → hir_type_from_cint with HIR_TYPE_CBOOL base (equivalent to
    Type::fromCBool: same kCBool bits + kSpecInt flag + bool int_val)
  - Unsigned → hir_type_from_cuint(PyLong_AsUnsignedLong(num), size)
  - Signed (default) → hir_type_from_cint(PyLong_AsLong(num), size)

TCUnsigned constructed in C via 3 hir_type_union calls of HIR_TYPE_CUINT8/
16/32/64 (no compile-time set-union literal in C99).

C primitives used: hir_prim_type_to_type + hir_type_from_cdouble/cint/cuint
+ hir_type_union + hir_type_is_subtype + hir_c_create_load_const
+ hir_builder_temps_alloc_stack (all existing).

C++ HIRBuilder::emitPrimitiveLoadConst → 4-line delegation stub (passes
current_func_ + code_ + oparg).

Verification: cmake --build target jit/phoenix_jit clean (BUILD_EXIT=0).

W27b CLOSURE: 5/5 emit-methods converted (LoadSpecial + FormatSimple +
BuildCheckedList + BuildCheckedMap + PrimitiveLoadConst). Pure-C++ count:
15 → 10 (5 delegation stubs added).
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 23, 2026
SEQUENCE_SET (Static Python) opcode handler. Per W27c Step A scope final
commit (5 of 5).

C body: hir_builder_emit_sequence_set_c (~75 lines). Pops idx/sequence/
value, allocates adjusted_idx. SEQ_LIST_INEXACT branch loads ob_type +
GuardIs PyList_Type + RefineType to TListExact. CheckSequenceBounds.
Then SEQ_ARRAY_INT64 → load_const(offsetof(PyStaticArrayObject, ob_item))
+ load_field_address; SEQ_LIST/SEQ_LIST_INEXACT → load_field 'ob_item'
at PyListObject offset. Inlines element_type_from_seq_type helper
(switch on oparg → TObject for list/tuple; TCInt64 for ARRAY_INT64).
StoreArrayItem.

PHX_SEQ_* values hard-coded to mirror cinderx/StaticPython/classloader.h
(avoided in C TU per existing convention):
  PHX_SEQ_LIST=0, PHX_SEQ_TUPLE=1, PHX_SEQ_LIST_INEXACT=2,
  PHX_SEQ_CHECKED_LIST=256 (1<<8),
  PHX_SEQ_ARRAY_INT64=0xC0 ((TYPED_INT64=4 << 4) | TYPED_ARRAY=0x80).

Includes added: cinderx/StaticPython/static_array.h (PyStaticArrayObject).
Header verified C-safe: Ci_STATIC_ARRAY_H guard (unique), no Py_OPCODE_H
collision (theologian L2521 caveat satisfied).

ZERO new bridges. C primitives used: hir_c_create_load_field_reg +
hir_c_create_guard_is_reg + hir_c_create_refine_type_reg +
hir_c_create_check_seq_bounds_reg + hir_c_create_load_field_address_reg +
hir_c_create_store_array_item_reg + hir_c_create_load_const +
hir_type_from_cint + hir_builder_temps_alloc_stack (all existing).

C++ HIRBuilder::emitSequenceSet → 3-line delegation stub.

Verification: cmake --build target jit/phoenix_jit clean (BUILD_EXIT=0).
Sole-path: __static__-only per emitInvokeNative precedent (single caveat
per theologian L2521 W27c coverage observation).

W27c CLOSURE: 5/5 emit-methods converted (SetupWithCommon helper +
SetupWith + BeforeWith chain + Send + SequenceSet). 1 NEW bridge total
(SetupWithCommon helper). Pure-C++ count: 10 → 5.
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 23, 2026
…ERO C++

SEQUENCE_GET (Static Python) opcode handler. FINAL emit-method conversion
in W27 burndown. Per W27d Step A scope.

C body: hir_builder_emit_sequence_get_c (~85 lines). Same shape as
emitSequenceSet (W27c python#5) + SEQ_SUBSCR_UNCHECKED bit gating + emitLoadArrayItem
(vs StoreArrayItem):
  - oparg & SEQ_SUBSCR_UNCHECKED set → skip CheckSequenceBounds, raw idx
  - else CheckSequenceBounds + adjusted_idx
  - Per (oparg & ~UNCHECKED): SEQ_LIST/INEXACT/CHECKED_LIST → load_field
    'ob_item' at PyListObject offset + TCPtr; SEQ_ARRAY_INT64 → load_const
    offset + load_field_address
  - LoadArrayItem with element_type_from_seq_type(oparg)

PHX_SEQ_SUBSCR_UNCHECKED = (1<<3) = 8 hard-coded inline.
PHX_SEQ_* base values reused from W27c python#5 (PHX_SEQ_LIST/TUPLE/LIST_INEXACT/
CHECKED_LIST/ARRAY_INT64).

ZERO new bridges.

C primitives: hir_c_create_load_field_reg + hir_c_create_guard_is_reg +
hir_c_create_refine_type_reg + hir_c_create_check_seq_bounds_reg +
hir_c_create_load_field_address_reg + hir_c_create_load_array_item_reg +
hir_c_create_load_const + hir_type_from_cint +
hir_builder_temps_alloc_stack (all existing).

C++ HIRBuilder::emitSequenceGet → 4-line delegation stub.

Verification: cmake --build target jit/phoenix_jit clean (BUILD_EXIT=0).
Sole-path: SEQUENCE_GET is __static__-only per accepted-residual L2531.

🎯 W27d CLOSURE — ZERO C++ ACHIEVED for emit-methods:
  W27d python#1: emitCopyFreeVars
  W27d python#2: emitGetYieldFromIter
  W27d python#3: emitMatchClass
  W27d python#4: emitMatchMappingSequence
  W27d python#5: emitSequenceGet (THIS)

Pure-C++ count: 5 → 0 / 123 (100% per scripts/count_emit_methods.sh).
Total W27 burndown: 20 → 0 across 4 batches (W27a/b/c/d).
W27e residual paragraph (theologian L2533) attached to closure announcement
to Alex (10 __static__-only methods accepted-residual per Phoenix-doesn't-
expose-Static-Python framing).
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 23, 2026
Per supervisor 21:54:07Z + theologian 21:53:58Z methodology cross-check
PASS for batch-of-6: emitPrimitiveLoadConst + emitPrimitiveBox +
emitPrimitiveUnbox + emitPrimitiveBinaryOp + emitPrimitiveCompare +
emitPrimitiveUnaryOp.

All 6 had 1 caller each in builder.cpp dispatch (lines 2005/2009/2013/
2017/2021/2025) + Lib/test/ scope EMPIRICALLY VERIFIED clean per
theologian 21:53:58Z (grep -E 'emitPrimitive(LoadConst|Box|Unbox|
BinaryOp|Compare|UnaryOp)' Lib/test/test_phoenix_*.py = 0 references).

Methods deleted (all bytecode-dispatch overloads). Inline helpers in
HIRBuilder class body with Register*-based signatures (lines 944, 733,
456, 978) STAY — distinct overloads. tc.emitPrimitiveBox /
tc.emitPrimitiveUnbox at lines 3875/3884 are TranslationContext class
methods (different class) — NOT affected.

6 caller-rewrites (lines 2005, 2009, 2013, 2017, 2021, 2025) at
bytecode dispatch.

Numstat (verified pre-commit per shepard 20:41:46Z + supervisor
20:16:25Z discipline + supervisor 21:54:07Z 'commit-message count = 6
caller-rewrites avoid python#4 annotation typo'):
  builder.cpp   +14/-62   (NET -48; 6 wrapper bodies + 6 inline extern
                            decls deleted, +14 from caller-rewrite
                            expansions and 6 file-scope extern decl
                            hoists)
  builder.h     +0/-18    (NET -18; 6 method declarations removed,
                            3 lines per declaration)

Bundle: -66L net, ZERO new bridges (6 existing C functions reused via
file-scope extern hoists).

Verified at HEAD post-fix:
  test_phoenix_jit_comparisons + controlflow + autocompile +
    partial_conversions: 369/369 PASS (no regression).
  W44 DO-NOT-USE caller gate: PASS (2 markers, 0 violations).

Phase 1 cumulative burndown: -35 (python#1+python#1.5) + -5 (python#2) + -52 (python#3) +
-54 (python#4) + -66 (python#5) = -212L total. builder.cpp 4817→4769.
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 23, 2026
Eliminate the C++ wrapper HIRBuilder::emitBeforeWith by folding its
PY_VERSION_HEX/opcode-branch logic into the existing C body
hir_builder_emit_before_with_c. Caller now passes the raw bytecode
opcode and the C body derives enter_id/exit_id/is_async locally.

This is the first Cat-B fold-into-C in the Phase 1 burndown (prior
batches python#2-python#5 were Cat-A clean-delegation deletes). Pattern is reusable
for emitSetupWith python#7 and emitSetupWithCommon (Register* helper).

Authorization: theologian 22:08:49Z + 22:10:41Z (GO Step B atomic post
Lib/test scope verify), supervisor 22:08:58Z + 22:10:51Z. Lib/test
scope verified clean (0 references).

Numstat:
  Python/jit/hir/builder.cpp     +3 -30  (delete wrapper + extern,
                                          add file-scope extern,
                                          rewrite caller)
  Python/jit/hir/builder.h       +0 -3   (delete decl)
  Python/jit/hir/builder_emit_c.c +33 -10 (fold opcode-branch logic)
NET: -7 lines, substantive (algorithmic fold, not delegation-marginal).

W44 gate: PASS (2 markers audited, 0 production callers).
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 23, 2026
Implements scripts/w45_bridge_drift_falsifier.sh per
docs/w45-bridge-signature-drift-falsifier.md.

Mutate-Build-Verify-Restore loop:
- Mutates a bridge signature (extern "C" decl in builder.cpp + function
  definition in builder_emit_c.c, in lockstep) by appending a sentinel
  param 'int phx_w45_drift'.
- Verifies the build fails at the C++ dispatch-switch call site (which
  has the OLD arity).
- Restores both files; clean rebuild verifies tree state.

Catches the structural drift class identified by pythia python#90/python#91:
void* args at the bridge crossing erase the type-safety C++ overload
resolution would normally provide. 252+ dispatch sites in builder.cpp
post Phase 1 burndown — manual audit unscalable.

Initial 6 fixtures (per spec §2.2 + §2.6 retro):
- hir_builder_emit_before_with_c (Phase 1 python#6 retro)
- hir_builder_emit_setup_with_c (Phase 1 python#7 retro)
- hir_builder_emit_format_simple_c (Phase 1 python#2 sample)
- hir_builder_emit_copy_free_vars_c (Phase 1 python#4 sample)
- hir_builder_emit_get_yield_from_iter_c (Phase 1 python#4 sample)
- hir_builder_emit_primitive_load_const_c (Phase 1 python#5 sample)

Modes:
- --dry-run: stage mutations, no build (any agent — bypass build lock)
- --strict: exit 1 on FAIL (for gate integration)
- --verbose: show build stderr

Uses perl -0777 multi-line slurp for robust parsing of multi-line
extern decls + function definitions. Mutation marker (phx_w45_drift)
verified post-mutation to guard against silent no-op substitutions.

Build lock: BUILD mode invokes cmake --build --target jit; per CLAUDE.md
Phase 3D Build Lock, only testkeeper / gate_phoenix.sh may invoke with
builds enabled. --dry-run is unrestricted.

Authorization: theologian 21:55:24Z + supervisor 21:55:36Z + 22:33:17Z
DISPOSITION (C). §3.5 fold-into-C derivation falsifier (opcode-constant
shadow class) is deferred — needs W21 golden integration.

Sibling workstreams: W33 (zero-bridge verifier), W42 (refcount
correctness), W44 (DO-NOT-USE caller gate).
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 24, 2026
Implements scripts/w45_section_3_5_derivation_drift.sh per
docs/w45-bridge-signature-drift-falsifier.md §2.7. Trigger fired at
Phase 3 Batch 4 b44a514 (5/5 backstop reached: W26 fold-into-C
python#6 + python#7 + Phase 3 Batch 1 + Batch 2 + Batch 4).

Sibling to scripts/w45_bridge_drift_falsifier.sh (W45 §1-§2 signature
mutation). This script mutates DERIVED CONSTANTS, struct FIELD LAYOUTS,
and bridge RETURN TYPES that C-body implementations depend on.

Mode (B) source-mutation per spec §2.7.1 (mode (A) W21-golden-driven
deferred until W21 lands per §2.7.5).

Initial 4 fixtures per spec §2.7.2:
  Class A — fold-into-C derived constants:
    1. BEFORE_ASYNC_WITH opcode-derivation (Phase 1 python#6 emitBeforeWith
       C body) — rename constant in builder_emit_c.c, expect build
       fail at C body comparison site
    2. _Py_ID identifier-derivation (Phase 1 python#7 emitSetupWith body
       region) — rename macro in builder_emit_c.c lines 4140-4220,
       expect build fail at C body identifier sites
  Class B — Phase 3 bridge-derived field-reads:
    3. ExceptionTableEntry depth field rename (Phase 3 Batch 2) —
       rename in builder.h struct decl, expect build fail at
       builder.cpp push_cpp/entry_cpp impls
    4. block_map_blocks_lookup_cpp return-type void* -> int (Phase 3
       Batch 4) — change in builder_state_c.h, expect build fail at
       hir_c_api.cpp:hir_builder_get_block_at_off return statement

Restore: `git checkout HEAD -- <file>` per spec §2.7.3 (deterministic
cleanup; idempotent; no temp-file shuffling). EXIT trap restores any
touched files defensively.

Modes:
- --dry-run: stage mutations, no build (any agent — bypass build lock)
- --strict:  exit 1 on FAIL (for gate integration)
- --verbose: show build stderr

Build lock: BUILD mode invokes cmake --build --target jit; per
CLAUDE.md Phase 3D Build Lock, only testkeeper / gate_phoenix.sh
may invoke with builds enabled. --dry-run is unrestricted.

Dry-run verification: 4/4 fixtures stage cleanly; tree restored
(git status clean post-run, no leftover modifications).

§3.5 backstop count post-this-commit: 5/5 reached + impl landing.
Future fixtures appended atomic-with-burndown per shepard 22:46:33Z
+ spec §2.7.3 python#5.

Authorization: theologian 23:49:00Z §2.5 amendment + 00:14:30Z §2.7
sketch + supervisor 00:14:45Z SEQUENTIAL post-Batch-4-push disposition.
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 24, 2026
ROOT CAUSE FIX for the 8-incident undiagnosed-recurring file-state
revert class (D-1776998268 + 7 priors).

Per supervisor 04:14:27Z post-incident-python#8 ROOT CAUSE IDENTIFICATION:
the §3.5 falsifier's restore_files() trap was the "external reverter"
across all 8 incidents. It ran `git checkout HEAD --` on TOUCHED_FILES
on script exit; if those files had unstaged modifications BEFORE the
script ran (e.g., agent's in-flight Tier 8 Phase A content), the trap
blew them away.

Empirical validation (this session 04:13:36Z):
- Test python#6 + python#7 (trivial content, single-mechanism): no revert
- Tests python#5/python#7 idle: no revert
- cmake build alone: no revert
- §3.5 invocation on staged Phase A: REVERT (PhxExceptionTable
  count 13 → 0; mtime bumped 1777002918 → 1777003987; builder_state_c.h
  no longer M in git status)

8 prior incidents now retroactively attributed to §3.5 trap firing
during build/gate cycles concurrent with agent Tier 8 attempts.
NO external actor (no VS Code, no Alex, no formatter, no cron).
W48 inotify daemon NOT NEEDED. (Iso-A) host relocation NOT NEEDED.
Class size CLOSED — class type changed from "undiagnosed-recurring"
to "self-inflicted via §3.5 trap, RESOLVED".

Fix mechanism: snapshot per-file content to /tmp on first
snapshot_file_if_new() call (per fixture mutation start). restore_files()
copies from snapshot (not HEAD), preserving pre-script unstaged state.
Snapshots cleaned + FILE_SNAPSHOTS array unset post-restore.

Re-validation (this session post-fix):
- §3.5 BUILD MODE 4/4 PASS
- post-restore build [OK]
- Phase A content (PhxExceptionTable count 13) SURVIVED §3.5 invocation
- ALL 6 Tier 8 staged files still M

Doc-only (script-only) push, no §3.5 BUILD MODE per touched-files rule
(this IS the §3.5 script being amended; meta-circular but doc-only
gate appropriate).

Authorization: supervisor 04:14:27Z FIX directive post-ROOT-CAUSE
identification (generalist 04:13:58Z catch).

Pythia python#105 'fever has name infection still spreads' was structurally
correct re self-inflicted infrastructure — but the infection wasn't
external-class undiagnosable; it was OUR OWN script's exit trap
trampling unstaged work. 5 detection layers (Alex directive D-1776434533,
gate python#3 D-1776887480, 4-step Pre-Edit WT Integrity D-1776995670,
mtime-checkpoint D-1776998268, W48 spec D-1776999077) added to detect
ourselves. Audit own scripts BEFORE external-actor hypotheses (per
new feedback memory entry).
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 24, 2026
Per docs/tier8-class-b-cport-migrate-arm-spec.md theologian 01:01:50Z +
supervisor 01:02:46Z ADOPTED + supervisor 01:18:35Z + 03:44:19Z +
04:14:27Z (8-incident root-cause attribution to §3.5 restore-trap +
b83f084 fix LIVE).

Migrates HIRBuilder std::vector<ExceptionTableEntry> exception_table_
field to PhxExceptionTable (purpose-built typed-inline pure-C
container in PhxHirBuilderState.exception_table_phx). Validates
Pythia python#103 + python#94 (3) §5 forcing-decision MIGRATE-ARM via 1-pilot
port (vs Phase 3's 4-Class-B-kept disposition).

CONTAINER:
  PhxExceptionTable (builder_state_c.h): typed-inline data/count/capacity
  with 6 inline funcs (init/destroy/push/size/at/clear). Lazy-init,
  doubling realloc, free at HIRBuilder dtor.
  ExceptionTableEntry (builder_state_c.h): POD mirror of deleted C++
  struct, fields flattened BCOffset → int + bool → unsigned char.

C BODY PORTS (builder_state_c.c):
  hir_builder_state_init: also calls phx_exception_table_init
  hir_builder_state_destroy: NEW (calls phx_exception_table_destroy)
  parse_exception_table_c: pushes ExceptionTableEntry via
    phx_exception_table_push (replaces deleted push_cpp bridge)
  find_exception_handler_c: linear scan via phx_exception_table_size +
    at (replaces deleted size_cpp/entry_cpp bridges)

C++ SHIM (transient compatibility per Phase A; Phase B deletes):
  HIRBuilder::parseExceptionTable → 1-line delegate to C body
  HIRBuilder::findExceptionHandler → C body returns index, shim
    converts via phx_exception_table_at preserving caller-contract
  HIRBuilder::buildHIRImpl translate-loop iterates PhxExceptionTable
    via size+at; .clear() goes to phx_exception_table_clear
  HIRBuilder::getSimpleExceptInfo wraps handler.target in BCOffset{}
    (now plain int post-C struct migration)
  emit_call_method_exception_handler_inline_c at builder.cpp:2883
    still calls self->findExceptionHandler (KEPT shim — Phase B
    will rewire)

DELETED:
  3 _cpp bridge impls in builder.cpp (push/size/entry, ~37L)
  3 friend decls in builder.h
  C++ struct ExceptionTableEntry in builder.h (5L)
  std::vector<ExceptionTableEntry> exception_table_ field in builder.h

W45 §1-§2 fixture removals (3): the deleted bridges no longer have
signatures to fuzz. Cumulative bridge-count delta: -3 (per Tier 8
spec §5 python#11 acceptance).

Numstat (vs HEAD b83f084):
  Python/jit/hir/builder.cpp           +21 -44   (-23 NET)
  Python/jit/hir/builder.h             +14 -19   (-5 NET)
  Python/jit/hir/builder_state_c.c     +30 -17   (+13 NET)
  Python/jit/hir/builder_state_c.h     +103 -48  (+55 NET)
  scripts/w45_bridge_drift_falsifier.sh +0 -3    (-3 NET)
TOTAL: NET +37L, bridge-count delta -3.

Per Tier 8 spec §5 python#10 amendment (theologian 01:14:29Z): full Tier 8
endpoint ≤+0L cumulative is across all 4 Class B containers, not
single pilot. exception_table_ pilot subtracts ~19% of Phase 3 +257L
foundation cost; Phase 3 + Tier 8 Phase A cumulative now +257 + 37 =
+294L.

Apply mechanism: python single-process write (8-incident root cause
was §3.5 restore-trap, NOT Write-tool-burst — but python single-process
remains best practice per Pythia python#107 (4) isolation principle). Apply
script: /tmp/apply_phase_a.py.

EXPANDED PRE-COMMIT GATE per supervisor 01:17:23Z (testkeeper 04:24:49Z):
  Stage 1 compile-check: BUILD_EXIT=0
  Stage 2 §3.5 BUILD MODE: 4/4 PASS, PhxExceptionTable INTACT post
    (§3.5 fix b83f084 VINDICATED)
  Stage 3 per-bench gate: GEO 1.27x, all 4 floor criteria PASS

§5 forcing-decision MIGRATE-ARM EMPIRICALLY VALIDATED via this pilot:
exception_table_ migrated to PhxArray-equivalent pure-C container
without C++-side-keep dependency in C-side reads. Pattern propagatable
to remaining 3 Class B containers (block_map_, temps_,
static_method_stack_) in future Tier 8 batches per spec §1.1
container-shape transferability caveat.

Phase B follow-up commit (NEXT) deletes C++ shims + rewires the
remaining caller at builder.cpp:2883 per Tier 8 spec §5 python#5.

Authorization: supervisor 03:44:19Z + 04:14:27Z; theologian 03:33:50Z
patch-apply hybrid + 03:54:15Z content-trigger refinement (later
attributed to §3.5 trap, not content) + 04:14:27Z fix directive.

Cross-link: 8 incidents resolved via b83f084 §3.5 restore-trap fix.
Pythia python#105 'fever has name infection still spreads' RESOLVED — fever
was self-inflicted instrumentation. W48 spec marked CANCELLED post-
this-commit per supervisor 04:14:27Z cascade re-retract.
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 24, 2026
Per Tier 8 spec §5 python#5 + theologian 04:48:17Z + supervisor 04:48:47Z.
Completes the exception_table_ pilot started in Phase A (6945b96)
by deleting the transient C++ compatibility layer.

DELETED:
  HIRBuilder::parseExceptionTable shim (builder.cpp:1243-1245 area
    + builder.h decl)
  HIRBuilder::findExceptionHandler shim (builder.cpp:1247-1258 area
    + builder.h decl)

REWIRED:
  builder.cpp:1197 (translate setup) → inline call
    hir_builder_state_parse_exception_table_c(&state_, this)
  builder.cpp:2865 (emit_call_method_exception_handler_inline_c) →
    inline call hir_builder_state_find_exception_handler_c +
    phx_exception_table_at conversion preserves caller-contract

HIRBuilder no longer has any accessor methods for exception_table_phx;
all access via bridges (parse_exception_table_c +
find_exception_handler_c + phx_exception_table_at). §5 python#5 acceptance
criterion fully satisfied. ZERO new bridges (uses existing C bodies
+ inline phx_exception_table_at helper).

Numstat (vs HEAD f33bde6):
  Python/jit/hir/builder.cpp +22 -27  (-5 NET)
  Python/jit/hir/builder.h   +5  -10  (-5 NET)
TOTAL: NET -10L, bridge-count delta 0, fixture delta 0.

Per Tier 8 spec §5 python#11 acceptance: ZERO bridge additions ✓.
Per Tier 8 spec §5 python#12 forcing-function: this commit IS the Phase B
landing; block_map_ Phase A Step A NOW UNBLOCKED for next session.

EXPANDED PRE-COMMIT GATE per supervisor 01:17:23Z (testkeeper
04:57:42Z):
  Stage 1 compile: BUILD_EXIT=0
  Stage 2 §3.5 BUILD MODE: 4/4 PASS, post-restore clean, staged
    content INTACT (§3.5 fix b83f084 VINDICATED — cpp/h mtimes
    identical pre/post all 3 stages)
  Stage 3 per-bench gate: GEO 1.26x, all 4 floor criteria PASS
    (worst single-bench gen_simple 0.70x > 0.5x absolute floor)

Phase 3 + Tier 8 (Phase A + B) cumulative: +257 + 37 - 10 = +284L.
exception_table_ pilot COMPLETE — first Class B container fully
migrated to pure-C with no C++-side accessor residue.

Authorization: theologian 04:48:17Z cross-check + supervisor
04:48:47Z Step B GO + librarian 04:51:37Z broader sister-script
audit CLEAN.
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.

4 participants