Skip to content

bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects - #188

Merged
zhangyangyu merged 1 commit into
python:3.5from
zhangyangyu:weakref-fix-3.5
Feb 20, 2017
Merged

bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects#188
zhangyangyu merged 1 commit into
python:3.5from
zhangyangyu:weakref-fix-3.5

Conversation

@zhangyangyu

Copy link
Copy Markdown
Member

No description provided.

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #188 into 3.5 will decrease coverage by -0.01%.
The diff coverage is n/a.

@@ Coverage Diff @@## 3.5 #188 +/- ##
==========================================
- Coverage 82.41% 82.41% -0.01% 
==========================================
Files 1404 1404 Lines 341433 341433 ==========================================
- Hits 281402 281396 -6 - Misses 60031 60037 +6
Impacted FilesCoverage Δ
Lib/sysconfig.py47.02% <ø> (-0.55%)
Lib/test/test_weakset.py96.45% <ø> (-0.28%)
Lib/test/test_random.py98.2% <ø> (-0.23%)
Lib/test/test_buffer.py96.53% <ø> (-0.18%)
Lib/test/test_asyncio/test_tasks.py97.1% <ø> (-0.07%)
Lib/test/test_io.py96.95% <ø> (-0.04%)
Lib/plistlib.py90.95% <ø> (+0.17%)
Lib/threading.py82.26% <ø> (+0.52%)
Lib/test/test_select.py89.23% <ø> (+1.53%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 314a86b...7e67474. Read the comment docs.

@zhangyangyu
zhangyangyu merged commit 7c95a94 into python:3.5Feb 20, 2017
@zhangyangyu
zhangyangyu deleted the weakref-fix-3.5 branch February 20, 2017 06:33
akruis added a commit to akruis/cpython that referenced this pull request Dec 31, 2018
…nd coroutines
Improve the finalisation of a soft switched YIELD_FROM instruction.
akruis added a commit to akruis/cpython that referenced this pull request Dec 31, 2018
…ed methods
Enable stackless calls of the following methods:
- generator.send() (generator.__next__() was already stackless);
- coroutine.send();
- coroutine_wrapper.__next__() and coroutine_wrapper.send();
- async_generator_asend.__next__() and async_generator_asend.send().
This change needs more tests.
akruis added a commit to akruis/cpython that referenced this pull request Jan 1, 2019
Fix a error handling in the YIELD_FROM finalisation code.
Add tests and changelog.txt
akruis pushed a commit to akruis/cpython that referenced this pull request Jan 12, 2019
…(async) generators and coroutines
Enable soft switching for iterators/coroutines called by "yield from".
Improve the finalisation of a soft switched YIELD_FROM instruction.
Enable stackless calls of the following methods:
- generator.send() (generator.__next__() was already stackless);
- coroutine.send();
- coroutine_wrapper.__next__() and coroutine_wrapper.send();
- async_generator_asend.__next__() and async_generator_asend.send().
akruis added a commit to akruis/cpython that referenced this pull request Apr 20, 2021
…#188
This commit fixes an assert statement, that could fail since python#188.
No functional change.
(cherry picked from commit 5595eec)
akruis added a commit to akruis/cpython that referenced this pull request May 27, 2021
…#188
This commit fixes an assert statement, that could fail since python#188.
No functional change.
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 27, 2026
…4.A.5 probe
Closes two spec gaps surfaced by pythia python#188 2026-04-27:
(a) §6 python#5 'PhxHirBuilderState 100% of state' acceptance criterion was
not mechanically testable — '100%' undefined, no falsifier. Now adds
explicit grep-rule against builder.cpp filtering out accepted access
patterns (state_.<field>, _cpp/_c bridge defs/calls, comments). Any
other hit = unmigrated C++ direct member access = fail acceptance.
(b) §4.A.5 inserted as a class-state extraction PROBE between Phase
4.A and 4.B. ~30-50 LOC, 1 commit. Pilot-5 dry-run on the simplest
Class A field (kwnames_) to surface silent-drift / mutator-enumeration /
JIT_DCHECK-equality risks BEFORE Phase 4.C burns its 33-53 commits on
the harder containers. §5.A close gate is LOC-trajectory only and
won't catch class-state failure modes; §4.A.5 fills that gap.
Authored 2026-04-27 per pythia python#188 + supervisor 2026-04-27T09:36:01Z.
'A rehearsal in an empty theater predicts only that the lights work.'
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 27, 2026
Pythia python#188 class-state-extraction PROBE (supervisor 2026-04-27T09:36:01Z
authored §4.A.5; supervisor 09:45:06Z accepted in-session execution;
theologian patch-shape APPROVE 09:49:24Z). Pilot-5 dry-run on the
simplest Class A field — kwnames_, the most-recent KW_NAMES Register*
slot — to surface class-state extraction failure modes (silent drift,
mutator-site enumeration miss, JIT_DCHECK equality drift) BEFORE
Phase 4.C burns 33-53 commits on harder containers.
Migration is single-commit + same-instant deletion:
Python/jit/hir/builder.h
Delete the C++ field 'Register* kwnames_{nullptr};'. Update the
Class A mirror comment (line 693-697) to reflect kwnames_ removal
+ document the §4.A.5 probe entry.
Python/jit/hir/builder.cpp
builder.cpp:2538 — sole C++ direct read site rewritten to
state_.kwnames == nullptr (post-translate KW_NAMES-stash invariant).
builder.cpp:2928-2935 — extern "C" hir_builder_get/set_kwnames
bridge bodies redirected to state_.kwnames; the static_cast<void*>
/ static_cast<Register*> drop because state_.kwnames is already
void* — no implicit conversion.
Mutator-site enumeration: ALL writes go through hir_builder_set_kwnames
(2 callers in builder_emit_c.c:968 + 3878); ALL reads go through
hir_builder_get_kwnames (3 callers in builder_emit_c.c:962 + 3857) +
the 1 direct-read C++ site at builder.cpp:2538. Zero C++ direct write
sites outside the bridge body — audited.
JIT_DCHECK equality (spec §4.A.5 step 3) is moot in the single-commit
migration: the C++ field is deleted in the same commit that redirects
the bridges, so no parallel state can drift. Theologian 09:49:24Z noted
the spec wording was overconservative for the single-commit case.
Falsifier (§6 python#5 grep-rule) result post-migration:
grep -nE '\\bkwnames_\\b' Python/jit/hir/builder.cpp
→ ZERO HITS. Field name is no longer anywhere in the codebase.
Build + ABBA: scripts/build_phoenix.sh --clean PASS (testkeeper
09:55:03Z). 4-bench ABBA GEO-MEAN 1.28x (matches BLME batch 2 baseline);
gen_simple 0.75x is pre-existing (BLME batch 2 0.74x; push-59 baseline
0.70x; same-session stable, structural causal absence — kwnames_
touches KW-arg dispatch not generator FRAME ops). No >5% drop trigger;
well above 1.0x floor.
Acceptance per spec §4.A.5: ABBA clean + zero functional regressions =
probe PASS = Class A delete approach VALIDATED for Pilot 5 across the
remaining Class A fields (code_ 46 sites, current_func_ ~30,
preloader_ 28, func_, static_method_stack_).
Sign up for freeto 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

@zhangyangyu@codecov-io@methane@the-knights-who-say-ni