◐ Shell
clean mode source ↗

bpo-5945: mapping.rst: PyMapping_Check(list) returns 1 by jbarlow83 · Pull Request #144 · python/cpython

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

@SonicField

…/100 PURE

(D) implementation per theologian 00:02:12Z scoping audit (overturned A1
'classloader.h C++-only' framing as incomplete) + supervisor 00:04:33Z
hold-lift (terminal goal pre-authorized via memory line 9 ZERO-C++).

Phase 3D status: 99/100 PURE-CONVERTED + 1 PARTIAL (emitLoadMethodStatic) →
100/100 PURE-CONVERTED. Phase 3D close criteria as Alex memory-line-9
directive: pure C, no C++ compiler needed for emit body.

CHANGES:

(1) Python/jit/hir/builder.h: 2 friend declarations for new bridges.
    - friend int ::hir_builder_preloader_invoke_method_slot_c(void*, PyObject*)
    - friend void ::hir_builder_state_static_method_stack_push_cpp(void*, void*)

(2) Python/jit/hir/builder.cpp:
    - HIRBuilder::emitLoadMethodStatic shrinks from 33 lines to 9 lines (pure
      type marshaling: just calls C body with bc_instr.oparg() + code_).
    - hir_builder_emit_load_method_static_c extern decl signature shrunk:
      drops is_classmethod, vte_state_offset, vte_load_offset, is_static,
      out_entry_func params; takes opcode oparg + code instead.
    - 2 new bridge implementations:
      - hir_builder_preloader_invoke_method_slot_c: returns slot from
        invokeMethodTarget (was C++-only access via private preloader_).
      - hir_builder_state_static_method_stack_push_cpp: pushes Register* to
        static_method_stack_ (mirrors existing _pop_cpp bridge).

(3) Python/jit/hir/builder_emit_c.c:
    - #include cinderx/StaticPython/classloader.h (transitively pulls
      vtable.h with _PyType_VTable + _PyType_VTableEntry struct defs).
      A1 framing was incomplete: vtable.h is already extern "C" wrapped +
      pure typedef struct (no class/template/namespace), safe in C TU.
    - Forward-decl 3 bridges used in C body.
    - Body adds C-side derivations (was C++ stub responsibility):
      * arg = PyTuple_GET_ITEM(code->co_consts, oparg) (constArg equivalent)
      * descr = PyTuple_GET_ITEM(arg, 0)
      * is_classmethod = _PyClassLoader_IsClassMethodDescr(arg)
      * slot = hir_builder_preloader_invoke_method_slot_c(builder, descr)
      * is_static = via existing hir_builder_invoke_method_target_c bridge
      * vte_state/load_offset = offsetof + slot arithmetic, wrapped in
        VTableByteOffset (P5 wrapper from push 58)
    - Conditional static_method_stack push moved from C++ stub to C body
      via hir_builder_state_static_method_stack_push_cpp bridge.
    - .v unwrap at the 2 boundaries to hir_c_create_load_field_reg
      (raw intptr_t API).

VERIFICATION pending: testkeeper rebuild + 30x all 8 W-2A+W-2B sentinels
(must remain 240/240 PASS, behavior-equivalent expected) + Phoenix suite
+ ABBA + dual-arch + INVOKE_*-style structural test
(test_phoenix_partial_conversions.py).

Per pythia python#144 python#2 + supervisor 00:04:33Z: Alex notification will follow
push 60 landing ('Phase 3D 100/100 PURE achieved via (D) — minimal scope
~30-60min, terminal goal directly served per memory line 9'). Per
feedback_dont_ask_just_do.md: terminal goal already authorized; (D) is
implementation path serving that authorization, not new scope.

Auth chain: theologian scoping audit 00:02:12Z + theologian go-direct
00:03:38Z + supervisor hold-lift 00:04:33Z + generalist (D) feasibility
verification 00:02:38Z.