{ "instance_id": "CPython_PEP-798-Unpacking-In-Subscripts_PR-143056", "project": "CPython", "requirement_doc": "https://peps.python.org/pep-0798/", "pr_link": "https://github.com/python/cpython/pull/143056", "pr_merge_date": "2025-12-22", "language": "C/Python", "build_system": "configure+make", "scope": { "touched_modules": [ "Grammar", "Parser", "Python", "Lib" ], "f2p_module": "Lib/test", "p2p_module": "Lib/test", "total_files_changed": 14 }, "base_commit": "5f57f6970bdea45cc2b192d612bfd8199f51491e", "diff_source": "gh_api_pr_files+manual_parser_c_reconstruction", "diff_source_note": "gh API omitted the full Parser/parser.c diff (1.4MB, >30k lines, generated via `make regen-pegen`). The parser.c diff was reconstructed locally by fetching raw.githubusercontent.com versions at base (5f57f6970bdea45cc2b192d612bfd8199f51491e) and integration (ccbe41e27cdb441033189f06148c23528275214b) commits, then running `git diff` on the two files. All other files in solution.patch come from gh PR API.", "solution_patch_sha256": "d434a165e781cf704e1dd4758701dce92a864686c720d30dd38d015c314232b9", "eval_tests_patch_sha256": "5d017b057e6bc3ed935b34cd098e1fe0dfd376904ec0acc8d33765831aa8dda7", "omitted_patch_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "toolchain": { "python_bootstrap": "system python3", "gcc": "11+" }, "build_modules": [ "./python" ], "test_framework": "cpython-unittest", "test_level": "system", "fail_to_pass": [ "test.test_unpack_ex", "test.test_exceptions.SyntaxErrorTests.test_encodings" ], "pass_to_pass": [ "test.test_int.IntTestCases.test_basic", "test.test_int.IntTestCases.test_invalid_signs", "test.test_int.IntTestCases.test_unicode", "test.test_dictcomps.DictComprehensionTest.test_assignment_idiom_in_comprehensions", "test.test_dictcomps.DictComprehensionTest.test_basics", "test.test_dictcomps.DictComprehensionTest.test_evaluation_order", "test.test_dictcomps.DictComprehensionTest.test_exception_locations", "test.test_dictcomps.DictComprehensionTest.test_global_visibility", "test.test_dictcomps.DictComprehensionTest.test_illegal_assignment", "test.test_dictcomps.DictComprehensionTest.test_local_visibility", "test.test_dictcomps.DictComprehensionTest.test_scope_isolation", "test.test_dictcomps.DictComprehensionTest.test_scope_isolation_from_global", "test.test_dictcomps.DictComprehensionTest.test_star_expression", "test.test_listcomps.ListComprehensionTest.test_assignment_expression", "test.test_listcomps.ListComprehensionTest.test_cell_in_nested_comprehension", "test.test_listcomps.ListComprehensionTest.test_comp_in_try_except", "test.test_listcomps.ListComprehensionTest.test_comp_in_try_finally", "test.test_listcomps.ListComprehensionTest.test_exception_locations", "test.test_listcomps.ListComprehensionTest.test_explicit_global", "test.test_listcomps.ListComprehensionTest.test_frame_locals", "test.test_listcomps.ListComprehensionTest.test_free_var_in_comp_child", "test.test_listcomps.ListComprehensionTest.test_global_in_class_scope", "test.test_listcomps.ListComprehensionTest.test_in_class_scope_inside_function_1", "test.test_listcomps.ListComprehensionTest.test_in_class_scope_with_nonlocal", "test.test_listcomps.ListComprehensionTest.test_lambda_in_iter", "test.test_listcomps.ListComprehensionTest.test_lambdas_with_free_var", "test.test_listcomps.ListComprehensionTest.test_multiple_comprehension_name_reuse", "test.test_listcomps.ListComprehensionTest.test_nameerror", "test.test_listcomps.ListComprehensionTest.test_nested", "test.test_listcomps.ListComprehensionTest.test_nested_2", "test.test_listcomps.ListComprehensionTest.test_nested_3", "test.test_listcomps.ListComprehensionTest.test_nested_4", "test.test_listcomps.ListComprehensionTest.test_no_leakage_to_locals", "test.test_listcomps.ListComprehensionTest.test_shadow_comp_iterable_name", "test.test_listcomps.ListComprehensionTest.test_unbound_local_inside_comprehension", "test.test_grammar.GrammarTests.test_comprehension_specials", "test.test_grammar.GrammarTests.test_dictcomps", "test.test_grammar.GrammarTests.test_genexps", "test.test_grammar.GrammarTests.test_listcomps", "test.test_grammar.GrammarTests.test_yield_in_comprehensions", "test.test_grammar.GrammarTests.test_async_for", "test.test_grammar.GrammarTests.test_async_await", "test.test_grammar.GrammarTests.test_selectors", "test.test_grammar.GrammarTests.test_atoms", "test.test_compile.TestSourcePositions.test_multiline_async_dict_comprehension", "test.test_compile.TestSourcePositions.test_multiline_async_generator_expression", "test.test_compile.TestSourcePositions.test_multiline_async_list_comprehension", "test.test_compile.TestSourcePositions.test_multiline_async_set_comprehension", "test.test_compile.TestSourcePositions.test_multiline_dict_comprehension", "test.test_compile.TestSourcePositions.test_multiline_generator_expression" ], "synthetic_tests": [], "triage": { "fail_to_pass": { "_summary": "PEP 798 introduces unpacking in subscripts/comprehensions: `[*x for x in ...]`, `{**d for d in ...}` syntax. test_unpack_ex.py gets new doctest examples exercising the syntax. test_exceptions.py gets updated error messages for cases where unpacking is invalid. Pre-patch: parser rejects new syntax → doctest SyntaxError mismatches expected output → test FAILED. Post-patch: parser accepts → matches → PASS." }, "pass_to_pass": { "_summary": "50 original P2P selectors. The original 3 test_int selectors remain as broad stable baselines; 47 pre-existing comprehension, grammar, and compile source-position selectors were added on 2026-06-15 to guard adjacent parser/codegen behavior that PEP 798 could accidentally affect but does not require changing. Added selectors are original CPython tests and are recorded in p2p.txt; synthesized P2P remains only in p2p_aug.txt." }, "module_scope_rationale": "test_unpack_ex covers the new syntax; test_exceptions covers updated error messages; test_dictcomps/test_listcomps/test_grammar/test_compile selectors are adjacent pre-existing parser/codegen P2P guards." }, "f2p_entry_count": 2, "p2p_entry_count": 50, "timeout_s": 7200, "resource_caps": { "cpu": 4, "mem_gb": 14 }, "validated_at": "2026-06-15", "build_status": "validated", "coverage_gap_note": "Union coverage is 48.8% (710 / 1455 executable C lines across Parser/parser.c, Python/Python-ast.c, Python/ast.c, Python/ast_preprocess.c, Python/codegen.c) after the 2026-06-15 original-P2P expansion, still below the 50% LoLBench floor. The added pre-existing comprehension/grammar/source-position P2P selectors raise P2P coverage to 600 covered lines and parser.c union coverage to 632/1356, but the remaining gap is concentrated in generated parser.c alternative branches (PEG parser fallback match attempts and error-recovery paths for unrelated syntax) and codegen.c mapping-comprehension edge cases. Cannot expand F2P further: (1) `grep -rln 'iterable unpacking\\|\\*.* for .* in'` across Lib/test/ returned only the two already-included files (test_unpack_ex.py, test_exceptions.py); (2) all other tests are untouched by this PR so they PASS pre-patch, violating §7 invariant if used as F2P; (3) the PR author chose to test only these two files — no synthesis allowed per LoLBench rules. Accepting as a documented below-floor coverage exception.", "repo": "python/cpython", "image": "lolbench/cpython-pr-143056:1", "pr_head_sha": "7c1625083c5c9478ded2200be4f047fb34fcd715", "merge_commit_sha": "7c1625083c5c9478ded2200be4f047fb34fcd715", "agent_contract": { "input": "/in/solution.patch", "output": "/out/agent_report.json", "invocation": "docker run --rm --memory 14g --cpus 4 -v $(pwd)/solution.patch:/in/solution.patch:ro -v $(pwd)/out:/out lolbench/cpython-pr-143056:1" }, "test_cmd_template": "./run_tests.sh ", "log_parser": "generic_log", "validation_summary": { "status": "passed", "validated_at": "2026-06-15", "command": "mounted docker validation for orig/aug/union pre and post on 2026-06-15", "suites": { "orig": { "pre": { "f2p": { "passed": 0, "failed": 1, "errored": 1, "skipped": 0, "total": 2 }, "p2p": { "passed": 50, "failed": 0, "errored": 0, "skipped": 0, "total": 50 }, "resolved": false, "build": "ok" }, "post": { "f2p": { "passed": 2, "failed": 0, "errored": 0, "skipped": 0, "total": 2 }, "p2p": { "passed": 50, "failed": 0, "errored": 0, "skipped": 0, "total": 50 }, "resolved": true, "build": "ok" } }, "aug": { "pre": { "f2p": { "passed": 0, "failed": 0, "errored": 10, "skipped": 0, "total": 10 }, "p2p": { "passed": 5, "failed": 0, "errored": 0, "skipped": 0, "total": 5 }, "resolved": false, "build": "ok" }, "post": { "f2p": { "passed": 10, "failed": 0, "errored": 0, "skipped": 0, "total": 10 }, "p2p": { "passed": 5, "failed": 0, "errored": 0, "skipped": 0, "total": 5 }, "resolved": true, "build": "ok" } }, "union": { "pre": { "f2p": { "passed": 0, "failed": 1, "errored": 11, "skipped": 0, "total": 12 }, "p2p": { "passed": 55, "failed": 0, "errored": 0, "skipped": 0, "total": 55 }, "resolved": false, "build": "ok" }, "post": { "f2p": { "passed": 12, "failed": 0, "errored": 0, "skipped": 0, "total": 12 }, "p2p": { "passed": 55, "failed": 0, "errored": 0, "skipped": 0, "total": 55 }, "resolved": true, "build": "ok" } } } }, "augmented": { "suite_support": [ "orig", "aug", "union" ], "eval_tests_patch": "eval_tests_aug.patch", "eval_tests_aug_patch_sha256": "9f7ed9f8256624d36af8a2a8f2a8391c4b4a044e37aa6f343f3746f18cfb2451", "f2p_aug_sha256": "70fd1fe5f526a5f81680d579adcedc43b3fa89fc8991a4dfc224844420e52e65", "p2p_aug_sha256": "a0c64e38277e4a946794a90c765a5bb0d375afe15a1656854313a85313542aa1", "fail_to_pass": [ "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_setcomp_star_unpacks_each_iterable", "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_listcomp_and_genexp_star_flatten", "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_dictcomp_double_star_merges_with_update_semantics", "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_dictcomp_double_star_compiles_from_ast", "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_async_listcomp_star_extends", "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_async_setcomp_star_updates", "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_async_genexp_star_flattens", "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_async_dictcomp_double_star_allows_duplicate_keys", "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_nested_and_conditional_unpacking_forms", "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_ast_shapes_of_unpacking_comprehensions" ], "pass_to_pass": [ "test.test_pep798_parser_stability_aug.ParserStabilityAugTests.test_broad_syntax_corpus_compiles_and_roundtrips", "test.test_pep798_parser_stability_aug.ParserStabilityAugTests.test_classic_comprehensions_unchanged", "test.test_pep798_parser_stability_aug.ParserStabilityAugTests.test_classic_call_and_display_unpacking_unchanged", "test.test_pep798_parser_stability_aug.ParserStabilityAugTests.test_unpacking_remains_illegal_outside_element_position", "test.test_pep798_parser_stability_aug.ParserStabilityAugTests.test_parser_error_positions_stable" ], "targets_mutants": [ "mutant_002_setcomp_parser_rejects_starred_element", "mutant_005_ast_validation_requires_dict_value", "mutant_008_setcomp_star_adds_iterable", "mutant_011_async_listcomp_star_appends_iterable", "mutant_012_async_dictcomp_double_star_rejects_duplicates" ], "triage": { "test_level_policy": "All augmented tests drive the documented PEP 798 syntax forms (* in list/set comprehensions and generator expressions, ** in dict comprehensions, async variants) through plain compile/eval — the new syntax itself is the documented public surface; no PR-internal symbol is referenced. The P2P stability tests pin pre-existing parser behavior (classic comprehensions, display/call unpacking, error positions) and pass on the base interpreter.", "fail_to_pass": { "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_setcomp_star_unpacks_each_iterable": { "requirement_sections": [ "Specification", "Semantics" ], "public_surface": "PEP 798 comprehension-unpacking syntax via compile/eval" }, "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_listcomp_and_genexp_star_flatten": { "requirement_sections": [ "Specification", "Semantics" ], "public_surface": "PEP 798 comprehension-unpacking syntax via compile/eval" }, "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_dictcomp_double_star_merges_with_update_semantics": { "requirement_sections": [ "Specification", "Semantics" ], "public_surface": "PEP 798 comprehension-unpacking syntax via compile/eval" }, "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_dictcomp_double_star_compiles_from_ast": { "requirement_sections": [ "Specification", "Semantics" ], "public_surface": "PEP 798 comprehension-unpacking syntax via compile/eval" }, "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_async_listcomp_star_extends": { "requirement_sections": [ "Specification", "Semantics" ], "public_surface": "PEP 798 comprehension-unpacking syntax via compile/eval" }, "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_async_setcomp_star_updates": { "requirement_sections": [ "Specification", "Semantics" ], "public_surface": "PEP 798 comprehension-unpacking syntax via compile/eval" }, "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_async_genexp_star_flattens": { "requirement_sections": [ "Specification", "Semantics" ], "public_surface": "PEP 798 comprehension-unpacking syntax via compile/eval" }, "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_async_dictcomp_double_star_allows_duplicate_keys": { "requirement_sections": [ "Specification", "Semantics" ], "public_surface": "PEP 798 comprehension-unpacking syntax via compile/eval" }, "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_nested_and_conditional_unpacking_forms": { "requirement_sections": [ "Specification", "Semantics" ], "public_surface": "PEP 798 comprehension-unpacking syntax via compile/eval" }, "test.test_pep798_unpacking_aug.UnpackingComprehensionAugTests.test_ast_shapes_of_unpacking_comprehensions": { "requirement_sections": [ "Specification", "Semantics" ], "public_surface": "PEP 798 comprehension-unpacking syntax via compile/eval" } }, "pass_to_pass": { "test.test_pep798_parser_stability_aug.ParserStabilityAugTests.test_broad_syntax_corpus_compiles_and_roundtrips": { "public_surface": "pre-existing Python syntax via compile/eval" }, "test.test_pep798_parser_stability_aug.ParserStabilityAugTests.test_classic_comprehensions_unchanged": { "public_surface": "pre-existing Python syntax via compile/eval" }, "test.test_pep798_parser_stability_aug.ParserStabilityAugTests.test_classic_call_and_display_unpacking_unchanged": { "public_surface": "pre-existing Python syntax via compile/eval" }, "test.test_pep798_parser_stability_aug.ParserStabilityAugTests.test_unpacking_remains_illegal_outside_element_position": { "public_surface": "pre-existing Python syntax via compile/eval" }, "test.test_pep798_parser_stability_aug.ParserStabilityAugTests.test_parser_error_positions_stable": { "public_surface": "pre-existing Python syntax via compile/eval" } } }, "validation_status": "validated_below_coverage_floor", "validation": { "augmented_pre": { "f2p": { "passed": 0, "failed": 0, "errored": 10, "total": 10 }, "p2p": { "passed": 5, "failed": 0, "errored": 0, "total": 5 }, "resolved": false }, "augmented_post": { "f2p": { "passed": 10, "failed": 0, "errored": 0, "total": 10 }, "p2p": { "passed": 5, "failed": 0, "errored": 0, "total": 5 }, "resolved": true }, "mutants": { "suite": "aug", "result": "all_targeted_killed", "per_mutant": "The 5 mutants undetected by the original suite are all killed by aug (genuine, build ok / error_categories empty): 002 setcomp-rejects-star -> setcomp tests (0P/10FE, SyntaxError); 005 ast-null-guard -> test_dictcomp_double_star_compiles_from_ast (subprocess); 008 setcomp SET_ADD -> test_setcomp_star_unpacks_each_iterable; 011 async-listcomp LIST_APPEND -> test_async_listcomp_star_extends; 012 async-dictcomp DICT_MERGE -> test_async_dictcomp_double_star_allows_duplicate_keys (subprocess, mutant segfaults). Mutants 001,003,004,007,010,013,014 are killed by the original suite (resolved=false in canonical mutation metadata eval_out); union kills all 12." } }, "coverage_attempts": 2, "coverage_gate": { "minimum_line_coverage_percent": 50, "status": "below_floor_documented", "coverage_report": "coverage_out/coverage_report_union.json", "union_line_coverage_percent": 48.8, "union_covered_lines": 710, "executable_lines_in_patch": 1455, "coverage_complete": true, "below_target_rationale": "1356 of the 1455 executable patch lines are Parser/parser.c — the bundle diff_source is \"gh_api_pr_files + manual_parser_c_reconstruction\", i.e. the ENTIRE regenerated PEG parser is in solution.patch, not just the comprehension rules PEP 798 changed. The PEP 798 behavioral logic is well covered by the F2P/augmented selectors; the union now covers 632/1356 of the generated parser after adding 47 pre-existing original P2P selectors, but the residual parser.c lines are alternative grammar productions and error-recovery branches for unrelated syntax that no PEP-798 test reaches. The union kills all 12 mutants; crossing the 50% floor is structurally blocked by the reconstructed-parser denominator under the current no-synthesized-F2P constraint." } }, "coverage": { "orig": 46.4, "aug": 40.9, "union": 48.8, "denominator": "suite_instrumented_executable_lines", "aug_note": "aug measured by mounting only augmented selectors into the concatenating coverage runner. Re-measured 2026-06-15 from a coverage image rebuilt from current bundle files: orig 46.4% (675/1455) and union 48.8% (710/1455) reproduce exactly and are stable across two runs; aug drifted from the prior 41.2% (599/1455) to a stable 40.9% (595/1455) due to benign run-to-run variation of incidental Parser/parser.c PEG-branch coverage in the aug F2P lane (parser.c f2p 390 -> 386). Reporting the stable/lower reproducible aug value." } }