• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

source-academy / py-slang / 37090996784
88%

Build:
DEFAULT BRANCH: main
Ran 03 Oct 2026 03:02AM UTC
Jobs 1
Files 144
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Oct 2026 02:47AM UTC coverage: 85.683% (+0.1%) from 85.548%
37090996784

push

github

web-flow
py2js: support rest parameters (*args) and spread arguments (#485)

* py2js: support rest parameters (*args) and spread arguments (f(*xs))

The py2js engine rejected `def f(*args)` ("rest parameters is not supported"),
and miscompiled `lambda *a: ...` by treating `*a` as an ordinary parameter, so
Python §3/§4 programs using them only ran on the CSE machine, PVML and wasm.

- A rest parameter compiles to a JS rest parameter: the array it collects is the
  Python list, as in CSE. The function is variadic (pyArity -1) with pyMinArgs
  set to its fixed-parameter count and a new pyRest flag, so arity() reports the
  fixed count like CSE and calling it with too few arguments is a TypeError
  ("f() takes at least N arguments but M were given").
- A `*xs` argument compiles to `...__py.spread(xs)` in both ordinary and tail
  calls, evaluated left to right with its neighbours. Like CSE, only a list can
  be spread (not a string); the callee gets a copy.
- A rest parameter that is not last (`def f(*a, b)`) is a compile error, as in
  PVML and wasm: the parser accepts it but there are no keyword-only parameters.
- A variadic user function crosses into a module with just its fixed parameters.

Chapters 1-2 still reject both via their validators.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* py2js: mark a rest function passed to a module as vararg

When `def f(a, *rest)` crossed into a module, closure_make was called without
isVararg, so the module's checked closure_call rejected any surplus argument
with InvalidArityError before pyClosureFunc could collect it into the rest
list. Pass `fn.pyRest` as isVararg, as the CSE and PVML bridges do, so the
declared arity acts as a minimum.

closure_make's isVararg argument is a GenericDataHandler extension that the
bare IDataHandler interface lacks, so pythonToModule, moduleToPython and
loadChunkImports now take the GenericDataHandler the engine already supplies.

Adds tests where a module calls a rest funct... (continued)

4976 of 6232 branches covered (79.85%)

Branch coverage included in aggregate %.

28 of 28 new or added lines in 3 files covered. (100.0%)

11153 of 12592 relevant lines covered (88.57%)

169095.12 hits per line

Jobs
ID Job ID Ran Files Coverage
1 37090996784.1 03 Oct 2026 03:02AM UTC 144
85.68
GitHub Action Run
Source Files on build 37090996784
  • Tree
  • List 144
  • Changed 8
  • Source Changed 3
  • Coverage Changed 8
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #37090996784
  • 0cf3c530 on github
  • Prev Build on main (#37087546853)
  • Next Build on main (#37093462041)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc