◐ Shell
clean mode source ↗

bpo-29546: Set path on ImportError for from ... import by Carreau · Pull Request #91 · python/cpython

brettcannon

brettcannon

brettcannon

brettcannon

And `path` as well when existing.

See bpo-29546

This is a step toward providing better error messages in case of
from-import. Barry Warsaw Proposed:

   cannot import name {name} from {module} ({path})

But that's probably going to trigger more discussions that filling in
already existing fields.
Make sure they name and path are set in various case.

@brettcannon brettcannon changed the title bpo-29546: Set name on ImportError for from ... import bpo-29546: Set path on ImportError for from ... import

Feb 14, 2017

brettcannon

@Carreau

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

Feb 20, 2017
Add location information like canonical module name where identifier
cannot be found and file location if available.

First iteration of this was pythongh-91

akruis pushed a commit to akruis/cpython that referenced this pull request

Sep 9, 2017
…ursion depth

Reset the recursion depth in PyTasklet_BindEx and add a few asserts.
This fixes issue python#91.
Add a test case for the recursion depth and as test case for an assertion failure caused by this bug.

https://bitbucket.org/stackless-dev/stackless/issues/91
(grafted from 1584a89fca366f66dadf3cf04f0306dd45b1372f and 380b70b1933d)

jaraco pushed a commit that referenced this pull request

Dec 2, 2022

This was referenced

Feb 11, 2025

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 23, 2026
Per testkeeper 22:44:12Z STRICT VERIFY: BUILD MODE was running
'cmake --build .' from REPO_ROOT, but cmake build dir is
Python/jit_build/build. All 6 fixtures errored with "not a CMake build
directory" → counted as FAIL → false GATE FAIL.

Fix: introduce CMAKE_BUILD_DIR variable + pass to both cmake calls
(per-fixture build at L153, post-restore rebuild at L194).

Concept already EMPIRICALLY VERIFIED by testkeeper manual sanity-test
on hir_builder_emit_format_simple_c — build failed at builder.cpp:2492
with "no matching function" + "candidate function not viable: requires
4 arguments, but 3 were provided". Exact void*-arg-erasure detection
pythia python#90/python#91 named.

Post-fix expected: 6/6 PASS in BUILD MODE.