Skip to content

fix: extend action should spread a scalar string by code point - #190

Open
spokodev wants to merge 1 commit into
nodeca:masterfrom
spokodev:fix/extend-spreads-scalar-string
Open

fix: extend action should spread a scalar string by code point#190
spokodev wants to merge 1 commit into
nodeca:masterfrom
spokodev:fix/extend-spreads-scalar-string

Conversation

@spokodev

@spokodev spokodev commented Sep 3, 2026

Copy link
Copy Markdown

action: 'extend' without nargs receives a single string value. Python's extend runs list.extend(values), and list.extend on a str iterates it by code point, so --foo abc produces ['a', 'b', 'c']. This port concatenates the string as a single element instead, producing ['abc'] — a silent divergence from the CPython 3.14.6 behaviour it targets (and not one of the intentional differences in doc/port_difference.md).

Spreading with Array.from when the value is a string matches Python's per-code-point iteration, including astral characters: --foo a😀b['a', '😀', 'b'], exactly as CPython 3.14.6 produces.

Sign up for free to 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.

1 participant