Skip to content

fix: to_js dict key 'size' collides with Map.prototype.size - #134

Merged
JohanMabille merged 1 commit into
emscripten-forge:mainfrom
Alex-PLACET:fix-to_js-dict-corruption
Oct 14, 2026
Merged

JohanMabille merged 1 commit into
emscripten-forge:mainfrom
Alex-PLACET:fix-to_js-dict-corruption

Conversation

@Alex-PLACET

Copy link
Copy Markdown
Contributor

The LiteralMap get trap read map[k] before map.get(k), so a stored key named "size" returned Map.prototype.size (the entry count) instead of the stored value. Check map.has(k) first, matching getOwnPropertyDescriptor.

The LiteralMap get trap read map[k] before map.get(k), so a stored key
named "size" returned Map.prototype.size (the entry count) instead of the
stored value. Check map.has(k) first, matching getOwnPropertyDescriptor.

Adds TestPyToJsDict regression tests (test_dict_size_key, int values,
roundtrip). Full browser suite: 88 pytest + 4 async passed.
@Alex-PLACET
Alex-PLACET marked this pull request as ready for review August 27, 2026 07:41
@JohanMabille
JohanMabille merged commit 8b8ca81 into emscripten-forge:main Oct 14, 2026
@Alex-PLACET
Alex-PLACET deleted the fix-to_js-dict-corruption branch October 14, 2026 12:03
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.

2 participants