Skip to content

webassembly/library: Fix ccall ABI for mp_hal_get_interrupt_char. - #19382

Merged
dpgeorge merged 1 commit into
micropython:masterfrom
o-murphy:fix/ports/webassembly-mp_hal_get_interrupt_char
Jul 10, 2026
Merged

dpgeorge merged 1 commit into
micropython:masterfrom
o-murphy:fix/ports/webassembly-mp_hal_get_interrupt_char

Conversation

@o-murphy

@o-murphy o-murphy commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adjust the ccall ABI for mp_hal_get_interrupt_char() on the WebAssembly port.
mp_hal_get_interrupt_char takes no arguments (void), but library.js was passing an argument.
calling it via Emscripten's ccall with a spurious ["number"]`` argument type
and ["null"] argument value:

// before (wrong)
Module.ccall("mp_hal_get_interrupt_char", "number", ["number"], ["null"]);

// after (correct)
Module.ccall("mp_hal_get_interrupt_char", "number", [], []);

Attempting to pass arguments to a no-arguments WebAssembly function, even with ccall, is against the type signature of the function and may result in misbehaviour, or even an exception being thrown, depending on the Emscripten build configuration.
See #19380 (the mp_hal_get_interrupt_char ABI part, as maintainer confirmed).

Testing

Tested on webassembly port (standard variant) under Node.js:

  • Existing test suite (make test) passes.

Generative AI

I used generative AI tools when creating this PR, but a human has checked the
code and is responsible for the code and the description above.

@o-murphy
o-murphy force-pushed the fix/ports/webassembly-mp_hal_get_interrupt_char branch from 1beac0f to 471e51d Compare June 26, 2026 09:10
@codecov

codecov Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.51%. Comparing base (552fd21) to head (98a935a).
⚠️ Report is 72 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19382   +/-   ##
=======================================
  Coverage   98.51%   98.51%           
=======================================
  Files         177      177           
  Lines       22927    22927           
=======================================
  Hits        22586    22586           
  Misses        341      341           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@o-murphy

Copy link
Copy Markdown
Contributor Author

@Gadgetoid

Copy link
Copy Markdown
Contributor

Also ran into this and have a patch for it in https://github.com/micropython/micropython/pull/19427/commits so +1, would reduce the surface of my unholy PR.

Comment thread ports/webassembly/README.md Outdated
Comment thread tests/ports/webassembly/hook_interrupt.js Outdated
@o-murphy
o-murphy force-pushed the fix/ports/webassembly-mp_hal_get_interrupt_char branch from 98a935a to c53df7e Compare July 9, 2026 15:08
@o-murphy
o-murphy force-pushed the fix/ports/webassembly-mp_hal_get_interrupt_char branch from c53df7e to a5bac1b Compare July 9, 2026 15:10

@dpgeorge dpgeorge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for updating.

@dpgeorge
dpgeorge merged commit a5bac1b into micropython:master Jul 10, 2026
7 checks passed
@o-murphy
o-murphy deleted the fix/ports/webassembly-mp_hal_get_interrupt_char branch July 10, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants