Skip to content

bpo-29453: Remove reference to undefined dictionary ordering in Tutorial#140

Merged
Mariatta merged 2 commits intopython:masterfrom
DimitrisJim:control_flow_dict
Feb 21, 2017
Merged

bpo-29453: Remove reference to undefined dictionary ordering in Tutorial#140
Mariatta merged 2 commits intopython:masterfrom
DimitrisJim:control_flow_dict

Conversation

@DimitrisJim
Copy link
Copy Markdown
Contributor

@DimitrisJim DimitrisJim commented Feb 16, 2017

As of Python 3.6 **kwargs are ordered, thus, remove the paragraph stating that
ordering is undefined and change snippet to remove the unnecessary sorted call.

Only issue that might need addressing as raised on the tracker is, if it is worth to mention that the output corresponds to the order of passed keyword arguments.

(Though this was already present with a patch on b.p.o I decided to turn it in a pull request since, I believe, it makes it easier to check and apply now that things are on Github)

As of Python 3.6 **kwargs are ordered, thus, remove the paragraph stating that
ordering is undefined and change snippet to remove the unecessary sorted call.
@serhiy-storchaka serhiy-storchaka added the docs Documentation in the Doc dir label Feb 18, 2017
@DimitrisJim
Copy link
Copy Markdown
Contributor Author

Added a sentence mentioning the guaranteed output order. Should I also make a PR for 3.6?

@Mariatta
Copy link
Copy Markdown
Member

Thanks @DimitrisJim
You don't have to create a separate PR for 3.6, core devs (in this case me) will do the backport :)
I'm travelling now for a conference, and will look into this after I'm back :)

@Mariatta Mariatta self-assigned this Feb 19, 2017
@Mariatta
Copy link
Copy Markdown
Member

Assigning this to myself per request by @rhettinger http://bugs.python.org/issue29453

@DimitrisJim
Copy link
Copy Markdown
Contributor Author

Thanks, @Mariatta!

@Mariatta Mariatta merged commit 32e8f9b into python:master Feb 21, 2017
Mariatta pushed a commit to Mariatta/cpython that referenced this pull request Feb 21, 2017
…ial (pythonGH-140)

As of Python 3.6 **kwargs are ordered, thus, remove the paragraph stating that
ordering is undefined and change snippet to remove the unecessary sorted call.

* Add sentence mentioning guaranteed output order of kwargs

(cherry picked from commit 32e8f9b)
Mariatta added a commit that referenced this pull request Feb 21, 2017
…ial (GH-140) (#208)

As of Python 3.6 **kwargs are ordered, thus, remove the paragraph stating that
ordering is undefined and change snippet to remove the unecessary sorted call.

* Add sentence mentioning guaranteed output order of kwargs

(cherry picked from commit 32e8f9b)
@DimitrisJim DimitrisJim deleted the control_flow_dict branch March 27, 2017 20:55
akruis pushed a commit to akruis/cpython that referenced this pull request Oct 29, 2017
- Initialize variable 'len' in function unwrap_frame_arg().
- Assign to '*valid' in function slp_find_execname().
- Disable GCC warning -Waddress in macro TASKLET_SETVAL(task, val).
- Update Stackless/changelog.txt for issues python#138, python#140
akruis pushed a commit to akruis/cpython that referenced this pull request Nov 7, 2017
- fix a warning about an unused expression result in ceval.c
- fix a warning about a non literal NULL-pointer initialization in
prickelpit.c
(cherry picked from commit 2b68ad3)
akruis pushed a commit to akruis/cpython that referenced this pull request Nov 7, 2017
- remove an unused declaration.

(cherry picked from commit e20d523)
akruis pushed a commit to akruis/cpython that referenced this pull request Nov 7, 2017
Fix warnings emitted by gcc 7.2.
- ceval.c: '*' in boolean context, suggest '&&' instead.
- stacklessmodule.c: a misleading indentation

(cherry picked from commit c51072e)
akruis pushed a commit to akruis/cpython that referenced this pull request Mar 25, 2018
- fix a warning about an unused expression result in ceval.c
- fix a warning about a non literal NULL-pointer initialization in
prickelpit.c
akruis pushed a commit to akruis/cpython that referenced this pull request Mar 25, 2018
- remove an unused declaration.
akruis pushed a commit to akruis/cpython that referenced this pull request Mar 25, 2018
Fix warnings emitted by gcc 7.2.
- ceval.c: '*' in boolean context, suggest '&&' instead.
- stacklessmodule.c: a misleading indentation
@Mariatta Mariatta removed their assignment Jun 10, 2018
akruis pushed a commit to akruis/cpython that referenced this pull request Jun 19, 2018
- Assign to '*valid' in function slp_find_execname().
- Disable GCC warning -Waddress in macro TASKLET_SETVAL(task, val).
- Update Stackless/changelog.txt for issues python#138, python#140

(cherry picked from commit 3461ccf)
akruis pushed a commit to akruis/cpython that referenced this pull request Jun 19, 2018
- remove an unused declaration.
akruis pushed a commit to akruis/cpython that referenced this pull request Jun 19, 2018
Fix warnings emitted by gcc 7.2.
- stacklessmodule.c: a misleading indentation

(cherry picked from commit c51072e)
jaraco pushed a commit that referenced this pull request Dec 2, 2022
SonicField added a commit to SonicField/cpython that referenced this pull request Apr 25, 2026
Per supervisor 21:23:07Z + theologian 21:23:08Z + theologian P7 audit
20:53:51Z. Moves emitAnyCall from PARTIAL Cat-B to PURE-CONVERTED
(Phase 3D 98/100 → 99/100). One PARTIAL Cat-B remains: emitLoadMethodStatic
(blocked on VTableByteOffset wrapper, landed in push 58).

CHANGES:

C body (Python/jit/hir/builder_emit_c.c hir_builder_emit_any_call_c):
- New signature: drop call_kind/is_kw_arg/is_awaited/const_arg params;
  add opcode (raw int) and BcByteOffset base_offset (P5 wrapper).
- Move opcode→PhxCallKind switch into C body. CALL/CALL_FUNCTION_EX
  from Include/opcode.h; CALL_FUNCTION/_KW/CALL_KW/CALL_METHOD from
  Python/jit_common/opcode_stubs.h (stubbed >255 in 3.12 but kept for
  forward compat).
- INVOKE_FUNCTION/NATIVE/METHOD opcode constants local-#define'd in C
  body (209/216/185 from Python/jit_interp/3.12/cinder_opcode_ids.h).
  Local-define avoids pulling cinder_opcode.h which would shadow
  Include/opcode.h's BINARY_OP_ADD_INT and break BINARY_OP
  specialization #ifdef (per existing comment at builder_emit_c.c:30).
  Guarded with #ifndef so future direct cinder_opcode_ids.h include
  doesn't conflict.
- is_awaited hardcoded 0 for 3.12 with #if PY_VERSION_HEX guard +
  #error fallback for older Python (Phoenix targets 3.12 exclusively).
  Older-Python path would need C-side bc_it/bc_instr accessors (out-
  of-scope; covered by existing C++ stub history in git log).
- const_arg = PyTuple_GET_ITEM(code->co_consts, oparg) for INVOKE_*.
  Per HIRBuilder::constArg @ builder.cpp pre-conversion: borrowed ref,
  no GC trigger, no refcount. Lifetime = code object = compile duration.
  Theologian 20:53:51Z P7 audit confirmed safe to extract on C side.
- base_offset.v unwrap at the one boundary
  (hir_builder_emit_call_method_exception_handler_inline_c, raw-int API).

C++ stub (Python/jit/hir/builder.cpp HIRBuilder::emitAnyCall):
- Shrinks from 67 lines to 12 lines: pure type marshaling delegation.
- Wraps base_offset via bc_byte_offset_from_int factory (Phase A.5).
- Added bytecode_c.h include for BcByteOffset visibility.

P6 EXECUTION-PATH COVERAGE:
- PHX_CALL_KIND_CALL_METHOD (CALL/CALL_METHOD/CALL_KW): EXERCISED by
  test_exc_raise_catch (CALL ValueError(...)) + 4 W-2A-DISPATCH-COVERAGE
  sentinels (try/else, try/finally with raise, nested try, raise-in-handler)
  + 4 W-2B-RECONVERT sentinels (raise/catch, BINARY_SUBSCR_DICT-in-try,
  continue-in-loop, multi-except-in-loop) + test_multiple_exceptions_in_loop.
- PHX_CALL_KIND_CALL_EX (CALL_FUNCTION_EX): EXERCISED indirectly by any
  test using *args/**kwargs unpacking; covered by Phoenix CPython suite.
- PHX_CALL_KIND_VECTOR_CALL (CALL_FUNCTION/_KW): DEAD in 3.12 (stubbed
  >255). Switch case kept for forward compat with older Python builds.
- PHX_CALL_KIND_INVOKE_FUNCTION/NATIVE/METHOD: COVERAGE GAP. INVOKE_*
  opcodes are Cinder static-Python only; vanilla CPython 3.12 compiler
  does NOT emit them. Pure Python sentinel cannot exercise these
  branches without Cinder static-Python infrastructure (not available
  in this build per theologian 21:32:27Z + supervisor 21:32:42Z
  fallback). Conversion is mechanical (PyTuple_GET_ITEM extraction +
  delegate to existing emit functions); structural test exists at
  Lib/test/test_phoenix_partial_conversions.py:52. Execution-level
  coverage queued as W-CINDERX-INVOKE-COVERAGE workstream
  (cinderx_dev integration post-Phoenix-integration).

Phase 0' HIR-DIFF planned (theologian step 4): test_exc_raise_catch +
4 W-2A sentinels + Phoenix suite — pre/post conversion HIR comparison
to detect any divergence.

Verification pending: testkeeper rebuild + 30x all 8 W-2A+W-2B-RECONVERT
sentinels + 30x test_multiple_exceptions_in_loop + Phoenix suite +
ABBA + dual-arch.

Per supervisor 21:32:42Z (post pythia python#140 python#2): full 24-bench ABBA
between push 59 (this) and push 60 (emitLoadMethodStatic conversion)
— single-commit bisect window for cap-clock at 73 commits since last
24-bench (cbb9453 2026-04-23).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants