GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-29474: Improve documentation for weakref.WeakValueDictionary by Mariatta · Pull Request #11 · python/cpython

Conversation

@Mariatta

@Mariatta Mariatta commented Feb 11, 2017

Copy link
Copy Markdown
Member

There were some grammatical errors in weakref.WeakValueDictionary
documentation.

This is to be applied to 2.7

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Mariatta
bpo-29474: Improve documentation for weakref.WeakValueDictionary
12fd14f
There were some grammatical errors in weakref.WeakValueDictionary
documentation.

This is to be applied to 2.7
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Feb 11, 2017
zware
zware approved these changes Feb 11, 2017
View reviewed changes

@zware zware left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trusting that the sentence makes sense in context, this does indeed fix the grammar. LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@zware
zware merged commit 5c32988 into python:2.7 Feb 11, 2017
@Mariatta
Mariatta deleted the bpo-29474py2 branch February 12, 2017 04:10
@Mariatta

Mariatta commented Feb 12, 2017

Copy link
Copy Markdown
Member Author

Thanks for the reviews, @zware :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Mariatta Mariatta added the cherry-pick for 2.7 label Feb 13, 2017
paulmon added a commit to paulmon/cpython that referenced this pull request Jan 10, 2019
@paulmon
Merge pull request python#11 from paulmon/win-arm32-pip
2f233f6
pip requires distutils
emmatyping referenced this pull request in emmatyping/cpython Feb 24, 2020
@emmatyping
Do not make IOBase generic (#11)
a05d9ae
@pablogsal pablogsal mentioned this pull request Jun 12, 2020
bpo-40958: Avoid buffer overflow in the parser when indexing the current line #20842
Closed
@shihai1991 shihai1991 mentioned this pull request Jun 23, 2020
bpo-1635741: Enable unicode_release_interned() without insure or valgrind. #21087
Closed
@larryhastings larryhastings mentioned this pull request Jun 7, 2022
The Great Argument Clinic Conversion Derby Meta-Issue #64386
Closed
@itachaaa itachaaa mentioned this pull request Aug 22, 2022
Python 3.10 hang at exit in drop_gil() (due to resource warning at exit?) #91414
Closed
@mdboom mdboom mentioned this pull request Aug 25, 2022
Assert and incorrect error message when loading source file containing invalid UTF-8 #96268
Closed
nanjekyejoannah added a commit to nanjekyejoannah/cpython that referenced this pull request Nov 17, 2022
@bors @nanjekyejoannah
Merge python#11
8deb7c5
11: Warn for function attributes r=ltratt a=nanjekyejoannah

Warn for function attributes

Co-authored-by: Joannah Nanjekye <[email protected]>
@mdboom mdboom mentioned this pull request Nov 22, 2022
Type punning (and strict aliasing) issue in Py_CLEAR() and Py_SETREF() macros: Python --enable-pystats is miscompiled #99701
Closed
@ziegenbalg ziegenbalg mentioned this pull request Nov 30, 2022
double free in io.TextIOWrapper #72573
Closed
@gvanrossum gvanrossum mentioned this pull request Aug 22, 2023
heap-use-after-free in _PyFunction_LookupByVersion #108253
Closed
@LinanV LinanV mentioned this pull request Oct 23, 2023
Objects/typeobject.c: No such file or directory. #111203
Closed
@stasos24 stasos24 mentioned this pull request Oct 24, 2023
Modules/cjkcodecs/_codecs_iso2022.c - read out of bounds #101180
Closed
@williamhu020 williamhu020 mentioned this pull request Nov 5, 2023
Use the API C of 'Py-NewInterpreterFromConfig' to exit unexpectedly in multiple threads. #111751
Closed
@kcatss kcatss mentioned this pull request Nov 15, 2023
Use-after-free in unregister() of atexit module #112127
Closed
@kcatss kcatss mentioned this pull request Jan 14, 2024
crash in long_vectorcall in longobject.c #114050
Closed
@kcatss kcatss mentioned this pull request Feb 12, 2024
Segmentation Fault in pthread_getcpuclockid function in time module #115378
Closed
@kcatss kcatss mentioned this pull request Feb 20, 2024
Use After Free at _heapreplace_max #115706
Closed
@ngoldbaum ngoldbaum mentioned this pull request Sep 23, 2024
Crash running PyO3 tests with --test-threads=1000 #124375
Closed
@Dean6767 Dean6767 mentioned this pull request Feb 10, 2025
🚨 Segmentation Fault in Python 3.10.12 when using OpenSSL (libcrypto.so.3) #129974
Closed
This was referenced Feb 11, 2025
segmentfault when pip installing setuptools #129992
Closed
segmentfault when pip installing setuptools #129993
Closed
@DominiquePACCO DominiquePACCO mentioned this pull request Jun 3, 2025
PdfWriter add_page adds (re)writes old page instead of new #135062
Closed
@efimov-mikhail efimov-mikhail mentioned this pull request Nov 5, 2025
memory leak in threading stack size #141044
Open
@sergey-miryanov sergey-miryanov mentioned this pull request Dec 18, 2025
Observed memory leak in ssl library: Python 3.14 GC issue #142516
Closed
@Qanux Qanux mentioned this pull request Feb 11, 2026
heap-buffer-overflow in functools.partial.__repr__() #144475
Closed
@ngoldbaum ngoldbaum mentioned this pull request Mar 6, 2026
Remove deprecated and undocumented function ctypes.SetPointerType #133866
Closed
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 22, 2026
@SonicField
gate: assert ARM64 gate binary identity (mirror x86_64 BINARY_MATCH)
0a5f096
Symmetric defense to e808676 — guards against any future ARM64
build-pipeline refactor (e.g., switching to cp-and-cache for build
speed) silently regressing the binary-identity property.

Today the ARM64 chain (cmake clean → fetch → checkout → build → test
in same repo) inherently couples binary identity to checked-out
commit, so the check is belt-and-suspenders. Per theologian
2026-04-22 00:47:10Z: the defense-in-depth value is in preventing
future regression of the safety property, not in catching today's
bugs.

After build_phoenix.sh + chmod +x python:
  - capture sys.version of the freshly-built binary
  - grep for $ARM64_COMMIT (the just-checked-out short hash)
  - exit 99 if absent, with explicit ARM64_BINARY_MISMATCH message

Existing 'ARM64_REMOTE_FAIL' cascade catches the non-zero exit and
fails the gate. Transcript carries verbatim ARM64_BINARY_MATCH or
ARM64_BINARY_MISMATCH for gatekeeper item python#11 verification.
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 22, 2026
@SonicField
builder: LOAD_ATTR_SLOT in C + delegating findTypeByVersionTag bridge
16da533
Push 42 (84/144 → 85/144 emit methods, 59%): bundles SLOT-specialization
conversion + bridge-guard fix per supervisor 01:39:54Z + theologian
01:40:13Z + gatekeeper 01:39:47Z delegation-approach concurrence.

================================================================
PART 1: BRIDGE GUARD FIX (delegation, not port)
================================================================

hir_c_api.cpp: replace broken findTypeByVersionTagWalk with 1-line
delegation to jit::hir::findTypeByVersionTag (builder.cpp:3829).

The prior in-file walk stripped 6 invariants from the C++ source +
missed the static-builtin indirection (getTypeSubclasses helper).
testkeeper caught it as SIGSEGV during cinderjit.force_compile(attr_probe)
post-warmup at 00:41Z (gate-binary contamination investigation).

Delegation chosen over verbatim port because invariants cannot be
stripped from a delegation: there is no copy. Future C++ retrofits
propagate automatically (e.g., D-1775642552 collision diagnostic when
implemented). Full BRIDGE SPEC TEMPLATE below.

----------------------------------------------------------------
BRIDGE SPEC TEMPLATE (theologian 01:39:09Z, archived as W7 reference)
----------------------------------------------------------------

Bridge: hir_find_type_by_version_tag
Purpose: Walk PyType subclass tree from PyBaseObject_Type, return type
         matching version_tag (or NULL). Used by LOAD_ATTR_SLOT to
         resolve slot_type from inline-cache version.
C++ source: builder.cpp:3795-3833 (findTypeByVersionTagImpl +
            findTypeByVersionTag + getTypeSubclasses)

PRIOR DECISIONS (scribe 01:37:08Z):
  D-1775580885: pymalloc reentrancy via Python __subclasses__ callback
                during HIR build. Bridge MUST NOT invoke Python during
                compile. (Inherited via delegation: C++ uses PyDict_Next
                + PyWeakref_GetObject, no Python call.)

  D-1775636801, D-1775636859: tp_subclasses for static builtin types
                (TPFLAGS_STATIC_BUILTIN: object, int, str) is a 1-based
                index into PyInterpreterState array, NOT a dict pointer.
                Direct tp_subclasses access = dead code on PyBaseObject_Type
                (the walk root). MUST use _PyStaticType_GetState. (Inherited
                via delegation: C++ getTypeSubclasses helper handles this.)

  D-1775637417: Zero-allocation walk crashed on ARM64 in prior session
                due to _PyType_GetSubclasses() PyList_New temp allocation.
                Current C++ uses PyDict_Next directly (no temp alloc).
                (Inherited via delegation; ARM64 pre-flight at 01:43Z
                confirms the fix is holding under RelWithDebInfo.)

  D-1775642552: Version-tag collision is an UNRESOLVED hypothesis class.
                If two types share a version_tag, walk returns wrong type
                → in auto-compile receiver matches → LoadField at wrong
                slot_offset → corruption. Diagnostic logging is a separate
                W-tracked workstream, not bridge-impl scope. (Inherited.)

INVARIANTS PRESERVED (via delegation, no copy — strongest preservation):
  1. Depth limit 50 (builder.cpp:3799) — prevents stack overflow on
     cyclic / very-deep subclass graphs.
  2. version == 0 short-circuit (builder.cpp:3830) — sentinel handling
     for the unspecialized version-tag value.
  3. PyDict_Check before PyDict_Next (builder.cpp:3810) — tp_subclasses
     may be NULL or non-dict for some types; PyDict_Next on non-dict is UB.
  4. PyType_Check on weakref-resolved subtype (builder.cpp:3817) — weakref
     may resolve to non-type if the subclass was gc'd or list contaminated.
  5. PyWeakref_GetObject (G form, NULL-safe) instead of _GET_OBJECT macro
     (builder.cpp:3816) — assumes-weakref macro returns Py_None on NULL
     but UB if argument isn't a weakref.
  6. _PyStaticType_GetState indirection for TPFLAGS_STATIC_BUILTIN
     (builder.cpp:3786-3793) — PyBaseObject_Type IS static-builtin; without
     this, walk dies at root.
  7. PyDict_Next direct iteration — zero pymalloc allocation in walk body
     (NOT _PyType_GetSubclasses which allocates via PyList_New). Required
     for ARM64 safety per D-1775637417.

Falsifier:
  - cinderjit.force_compile(attr_probe-with-warmup) on x86_64 completes
    without SIGSEGV. (Verified compile-clean; gate result follows.)
  - Same on ARM64 RelWithDebInfo per testkeeper pre-flight 01:43:22Z PASS:
    'JIT_ENABLE=1 ./python /tmp/g1_6_force.py → FORCE_COMPILE_OK ✓'
    'JIT_ENABLE=1 ./python /tmp/g1_5_auto_compile_capture.py → AUTO_COMPILE_OK ✓'

W7 — full C port of findTypeByVersionTag (post-Tier-5, MEDIUM, queued):
  Owner: theologian design (this spec) + generalist implement
  Trigger: when builder.cpp deletion approaches AND findTypeByVersionTag
           chain is the next C++ surface to convert
  Acceptance: this 7-invariant spec satisfied + ARM64 pydebug pre-flight
              PASS (W8 must complete first) + post-port differential
              JIT_DCHECK PASS

================================================================
PART 2: LOAD_ATTR_SLOT WIRING
================================================================

builder_emit_c.c: hir_builder_emit_load_attr_slot_c, ~42 lines.
builder.cpp: emitLoadAttr LOAD_ATTR_SLOT case shrinks to delegating stub
(46 lines deleted, 6 lines added).

----------------------------------------------------------------
PER-SPECIALIZATION RUBRIC (theologian 00:24:00Z, 8 common + 4 SLOT)
----------------------------------------------------------------

Common items (cited per gatekeeper review):

1. Source structural diff: C body in builder_emit_c.c mirrors C++ logic
   line-for-line (cache lookup → type guard → load slot → check NULL).
   C++ stub in builder.cpp passes (tc, func, builder, receiver, code,
   name_idx, instr_idx); C body returns 1 on success / 0 to fall back.

2. Bridge usage audit:
   - hir_builder_get_attr_cache(builder, instr_idx, &type_version, &slot_offset)
     [hir_c_api.cpp:2653, reads _PyAttrCache via Preloader's code]
   - hir_find_type_by_version_tag(type_version) [delegation, see Part 1]
   - hir_func_add_reference(func, slot_type) [hir_c_api.cpp:168, roots
     the type pointer through GC for compiled-code lifetime]
   - hir_type_from_pytype(slot_type, 1) [exact-type HirType construction]
   - hir_c_create_guard_type_reg(receiver, type, receiver) [no-FS variant
     matches C++ tc.emitGuardType 3-arg form at builder.cpp:3964]
   - hir_func_alloc_register, hir_c_create_load_field_reg,
     hir_c_create_check_field_reg, hir_c_set_guilty_reg
   All bridges exist; ordering matches C++.

3. Reference annotation: receiver is BORROWED (read from stack),
   guarded result is the same register (in-place narrow), LoadField
   result is owned-or-NULL (TOptObject = OBJECT|NULLPTR), CheckField
   raises AttributeError on NULL via guilty_reg=receiver. Matches C++.

4. FrameState capture: GuardType uses no-FS variant (matches C++ which
   also calls 3-arg tc.emitGuardType for SLOT). CheckField uses FS-aware
   variant (hir_c_create_check_field_reg with &tc->frame). Snapshot is
   not explicitly emitted; the existing tc.frame supplies state for
   CheckField deopt.

5. Wiring exercise: existing emitCond wiring at gate_phoenix.sh:347
   exercises Point class with .x/.y/.z dict-attrs (not __slots__). For
   __slots__ specifically, the existing test_phoenix_jit_loadattr_golden
   harness (Lib/test/test_phoenix_jit_loadattr_golden.py) exercises the
   exact attr_probe pattern (Pt with __slots__) — gate_phoenix.sh runs
   this in PHOENIX_MODULES.

6. Golden diff exact match (HARD GATE): docs/golden/loadattr_hir.txt
   captured at C++ baseline (push 35 aa430e6). After this push, the
   SLOT block of the golden must remain byte-identical. testkeeper to
   re-run test_phoenix_jit_loadattr_golden and post the diff result —
   if non-empty, HALT push 42.

7. Py_REF_DEBUG delta: this is the FIRST LoadAttr conversion; baseline
   from C++ = +1772 (per supervisor 00:00:17Z). After SLOT lands, run
   pydebug Python with sys.gettotalrefcount() before/after the LoadAttr
   test suite, post delta. Must be within 5% of +1772 baseline.

8. ARM64 commit-match + 4 stash markers: per gatekeeper item python#11,
   testkeeper's gate excerpt must show BOTH BINARY_MATCH (clean) lines
   + commit-match + stash markers. Standard discipline.

SLOT-specific items:

S1. Slot offset comes from _PyAttrCache->index via hir_builder_get_attr_cache
    bridge (NOT hand-coded). The cache is the canonical CPython source for
    LOAD_ATTR_SLOT specialization data. Matches C++ behavior at builder.cpp:3946.

S2. LoadField uses TOptObject (OBJECT|NULLPTR) for the slot output type,
    matching C++ tc.emitLoadField(attr, receiver, "slot", slot_offset, TOptObject)
    at builder.cpp:3970. Constructed via hir_type_union(HIR_TYPE_OBJECT,
    HIR_TYPE_NULLPTR) — semantic equivalent of C++ TOptObject.

S3. Subclass check: C version returns 0 (fallback to generic LoadAttr) if
    slot_type has subclasses (PyDict_GET_SIZE(tp_subclasses) > 0). Matches
    C++ guard at builder.cpp:3956 — without the subclass check, GuardType
    against a parent type would fail when receiver is a subclass instance,
    causing unnecessary deopt.

S4. dk_version Guard (per theologian rubric): for SLOT specifically, the
    GuardType against slot_type SERVES the version-check role. CPython's
    _PyAttrCache->version is checked at adaptive-specializer time to set
    LOAD_ATTR_SLOT; the JIT GuardType then ensures the runtime receiver
    type matches what was cached. This satisfies S4 in spirit (type-version
    guard precedes LoadField), even though the constant materialization is
    not via separate Guard<dk_version> instruction.

================================================================
VERIFICATION (compile-clean pre-commit)
================================================================

cmake --build Python/jit_build/build --target phoenix_jit:
  [ 96%] Built target jit
  [100%] Built target phoenix_jit
  0 errors. Pre-existing warnings only.

Pre-flight ARM64 (testkeeper 01:43:22Z, RelWithDebInfo PASS at HEAD ae8224e):
  - JIT_ENABLE=1 ./python /tmp/g1_6_force.py → FORCE_COMPILE_OK ✓
  - JIT_ENABLE=1 ./python /tmp/g1_5_auto_compile_capture.py → AUTO_COMPILE_OK ✓
  - D-1775637417 fix is holding for production C++ findTypeByVersionTag
    on ARM64. Delegation inherits this safety.

Pydebug ARM64 deferred to W8 per supervisor 01:45:32Z (pre-existing
libfmt.a linker issue, separate from SLOT scope).

Diff stat: 3 files changed, 56 insertions(+), 62 deletions(-).
  builder.cpp: -46 +6 (LOAD_ATTR_SLOT case → delegating stub)
  builder_emit_c.c: +42 (hir_builder_emit_load_attr_slot_c)
  hir_c_api.cpp: -16 +6 (broken walk → delegation)
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 24, 2026
@SonicField
docs: pythia python#104 + python#105 amendments to Tier 8 spec + CLAU…
e8a83df
…DE.md

Bundle of two theologian-authored doc amendments per supervisor
dispositions:

CLAUDE.md (+2L) — Pre-Edit WT Integrity 'undiagnosed-recurring'
honest framing per pythia python#105 (3) + supervisor 02:13:12Z + theologian
02:13:54Z. Acknowledges 5+ prior incidents closed at SYMPTOM layer
without root-cause attribution; this 4-step discipline codifies
reactive HALT, not automated detection. Detection still depends on
agent noticing mid-edit. Recurrence-prevention claim does not exceed
what text mechanizes; automated detection feasibility (file-watcher /
git-hook) is fixup PIR territory and remains open.

docs/tier8-class-b-cport-migrate-arm-spec.md (+93/-20) — pythia python#104
amendments per theologian 01:38:08Z + supervisor 01:38:26Z + 01:37:05Z:
  §1.1 container-shape transferability caveat (vector-pilot ≠ hash/
       stack/allocator-shape pattern transferability)
  §5 python#11 NEW: bridge-count-delta acceptance (each pilot must NET-
       SUBTRACT bridges OR honestly add with W45 fixture coverage)
  §5 python#12 NEW: Phase B FORCING-FUNCTION (Tier 8 SECOND-PILOT block_map_
       Step A BLOCKED until exception_table_ Phase B commit lands)

Bundle scope: doc-only, no §3.5 BUILD MODE (no builder*.{cpp,h,c}
touched). Atomic per supervisor 02:13:12Z + 01:38:26Z dispositions.

Push 28 advances the Tier 8 Phase A resume deadline tracker per
theologian 02:13:54Z + supervisor 02:13:12Z (push 28 OR session-end
whichever first). If Alex disposition + fixup PIR not received by
deadline, theologian amends Phase 3 closure summary fa8dfef to
remove Tier 8 pilot citation + re-opens pythia python#103 escape question.
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 24, 2026
@SonicField
Tier 8 Pilot Phase A: exception_table_ → PhxExceptionTable migration
6945b96
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
@SonicField
Tier 8 Pilot Phase B: delete C++ shims + rewire callers (§5 python#5)
6acfbf6
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.
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 24, 2026
@SonicField
Tier 8 SECOND-PILOT Phase A: block_map_.blocks → PhxBlockMap (custom …
72bb8e9
…hash)

Migrates the BCOffset→BasicBlock* lookup from std::unordered_map to a
purpose-built open-addressed hash (Knuth multiplicative, linear probing,
load factor 0.7) living in PhxHirBuilderState.block_map_phx. Custom hash
chosen per spec §2.1 strict path because the D2 block-count measurement
(2026-04-24) showed re._parser:Tokenizer.__next at 294 blocks and
Tokenizer.get at 147 — PhxArray linear-scan would be O(n²) on these
real stdlib hot paths.

Net bridge delta: -1 (per Tier 8 spec §5 python#11 net-subtract).
- DELETED hir_builder_state_block_map_blocks_lookup_cpp (Phase 3 Batch 4)
- DELETED hir_builder_get_block_at_off (Tier 2 emit-conversion bridge)
- ADDED phx_hir_builder_state(builder) — canonical state-from-builder
  accessor; future Phase B/C/D pilots reuse the pattern.

block_map_.bc_blocks (heavy BytecodeInstructionBlock value-type) stays
C++-side this phase; only the BCOffset→BasicBlock* lookup migrated.
HIRBuilder::getBlockAtOff body now delegates to phx_block_map_lookup;
the C++ method shell is deferred to a later phase.

12 C-side caller sites in builder_emit_c.c rewired to
phx_block_map_lookup_or_panic(&phx_hir_builder_state(builder)
->block_map_phx, off). NULL-value invariant verified pre-commit:
the sole insert site (createBlocks) takes the value from
CFG::AllocateBlock() = `new BasicBlock(id)` which never returns NULL.

Falsifiers bundled:
- test_phx_block_map.c: 8 unit tests (init/insert/resize-trigger at
  cap=16/N=300/synthesized collisions/overwrite/miss/clear).
- gate_phoenix.sh: block_map_resize_chain (10-arm if/return,
  ~25 block_starts) added to wiring-gate force_compile fixtures so
  PhxBlockMap_resize fires deterministically (testkeeper 10:29:06Z gap
  flag — prior wiring fixtures were all <12 BBs).
- w45_bridge_drift_falsifier.sh: lookup_cpp fixture retargeted to
  phx_hir_builder_state.
- w45_section_3_5_derivation_drift.sh: Fixture 4 retargeted to
  phx_hir_builder_state return-type mutation
  (PhxHirBuilderState* → int breaks the 12 caller derefs).

Auth chain: theologian patch-shape APPROVE 10:28:51Z + 10:33:54Z (β2)
+ 10:41:07Z (revisions); supervisor authorization 10:25:19Z + 10:29:05Z
+ 10:29:22Z; librarian §5 python#11 net-subtract precedent 10:30:04Z;
testkeeper pre-commit BUILD PASS + 8/8 unit PASS 10:46:46Z.
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 24, 2026
@SonicField
Tier 8 SECOND-PILOT Phase B: block_map_.bc_blocks → PhxBcBlockArray
4145fe3
Closes the SECOND pilot. Migrates the BasicBlock* → BytecodeInstructionBlock
mapping from std::unordered_map to a dense array indexed by BasicBlock::id,
exploiting the production-validated invariant that ids are
allocation-monotonic from 0 (cfg.h:139-144 `id = next_block_id_++`). Choice
of B-γ (dense array) over B-α (parallel hash) per theologian 11:13:21Z:
no hash, no collisions, no resize-on-load-factor — three classes of bug
B-α can have, B-γ cannot. Pattern is new (id-indexed dense array vs hash)
but well-suited to the data shape.

Combined with Phase A (push 39, 72bb8e9), block_map_ is ENTIRELY
migrated to PhxHirBuilderState. The wrapping BlockMap C++ struct + the
block_map_ C++ field are DELETED.

Net bridges: 0 (no new bridges; bc_blocks had zero C-side callers per
inventory). Per theologian 11:19:42Z: §5 python#11 prevents UNCONTROLLED bridge
growth, so a net-0 pilot is neither violation nor satisfaction — Phase B's
substantive deliverable is std::unordered_map elimination, which advances
the ZERO-C++ terminal goal equivalent to bridge subtraction.

PyCodeObject* code is constant per-compile and lives on
PhxHirBuilderState.code (set in HIRBuilder ctor), so it is not stored
per-array-slot — saves 8 bytes per block.

Three invariants asserted (theologian 11:13:21Z):
- I1 (JIT_DCHECK at createBlocks return): bc_block_array.count ==
  block_map_phx.count. The two are populated in lockstep on every loop
  iteration; counts must agree.
- I2 (JIT_DCHECK at buildHIRImpl read): tc.block->id <
  bc_block_array.count. Catches HIR-pass-created blocks accidentally
  being looked up; should never happen but assert it.
- I3 (documented, not asserted): BasicBlock::id is read-only post-
  allocation. No HIR pass renumbers ids; if any future pass does, B-γ
  is wrong. RPO and other passes traverse, never renumber. Runtime
  sentinel would defeat the dense-array O(1) win.

Lazy-grow uses single-realloc max(old_cap*2, block_id+1) per theologian
11:19:42Z verification (block_id=1000 with old_cap=16 is 1 alloc, not
7 doublings).

CALLER REWRITES (2 functional sites):
- builder.cpp createBlocks: writes both state_.block_map_phx (Phase A)
  and state_.bc_block_array_phx (Phase B) in lockstep. Return type
  void (was BlockMap).
- builder.cpp buildHIRImpl: read site reconstructs BytecodeInstructionBlock
  value from {code_, BCIndex{start}, BCIndex{end}} using array entry +
  state_.code (constant per-compile). Subsequent .begin/.end/iteration
  works on the local value identically to the old map-reference.

UNIT TESTS: +6 PhxBcBlockArray tests (init/insert+at/lazy-grow/n300/
clear/overwrite-same-id) appended to test_phx_block_map.c. Existing 8
PhxBlockMap tests unchanged.

GATE COVERAGE: the existing block_map_resize_chain wiring fixture (Phase A
push 39) exercises createBlocks which now populates BOTH structures in
lockstep, so PhxBcBlockArray growth is implicitly covered. Pythia python#119
(a) n=294 coverage extension is a separate followup commit (theologian
11:20:24Z + supervisor 11:20:43Z DEFERRED — sequence-isolated, not
bundled).

Auth chain: theologian B-γ pick 11:13:21Z + patch-shape APPROVE 11:19:42Z
(2 verifications applied at 11:20:15Z); supervisor 11:13:46Z + 11:18:54Z
+ 11:20:43Z; shepard sequence-isolation 11:11:59Z; librarian §5 python#11
non-violation framing 11:15:58Z.
This was referenced Jul 18, 2026
free threading: struct iter_unpack is not memory safe #154013
Closed
use-after-free: functools partial #154189
Closed
@chongwick chongwick mentioned this pull request Aug 19, 2026
segv in ceval #156074
Closed
@gabyfle gabyfle mentioned this pull request Sep 1, 2026
[3.13] gh-132396: Resolve 'redefinition of unused name' errors in Lib/test/ (GH-132397) #132699
Merged
This was referenced Sep 11, 2026
Heap-buffer-overflow in the hz incremental decoder on a trailing ~ #157325
Closed
mmap.mmap.__setitem__ crashes when concurrently resized #157335
Closed
Heap UAF in io.TextIOWrapper read path via reentrant detach() #157363
Open
@hosu3das20s05s hosu3das20s05s mentioned this pull request Sep 24, 2026
AddressSanitizer: global-buffer-overflow Modules/_decimal/_decimal.c:798:37 in signaldict_richcompare #158063
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@zware zware zware approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Mariatta @zware @the-knights-who-say-ni
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.