Skip to content

Preserve parsed values for prototype-named destinations - #193

Closed
xiehuanyi wants to merge 1 commit into
nodeca:masterfrom
xiehuanyi:fix/prototype-named-namespace-attributes-20261011
Closed

xiehuanyi wants to merge 1 commit into
nodeca:masterfrom
xiehuanyi:fix/prototype-named-namespace-attributes-20261011

Conversation

@xiehuanyi

Copy link
Copy Markdown

A destination named __proto__ is currently consumed by JavaScript's inherited prototype setter: parsed strings disappear and object defaults change the namespace prototype. For example, parser.add_argument('--value', { dest: '__proto__' }) followed by parse_args(['--value', 'parsed']) produces no own destination attribute.

Define that name as an ordinary own attribute in the shared setter. Use the same setter when initializing a Namespace while preserving enumerable symbols, null sources, and boxed primitive source behavior.

The three new destination/initializer regressions fail before the change. They cover explicit values and object defaults, append/count actions on a supplied namespace, and enumerable symbol copying. Compatibility checks also cover Namespace(null) and Namespace('x').

Validation on Node 22: npm test passes lint and all 1906 tests; git diff --check passes.

Copilot AI balanced review requested due to automatic review settings October 11, 2026 12:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@puzrin

puzrin commented Oct 11, 2026

Copy link
Copy Markdown
Member

Garbage

@puzrin puzrin closed this Oct 11, 2026
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.

3 participants