Bubobubobubobubo/sardine

@swim function crashes when re-evaluated with less arguments

Opened this issue · 1 comments

loig commented

When evaluating this:

@swim
def somePrints(k=0):
    print("v1:", k)
    again(somePrints, k=k+1)

and then this:

@swim
def somePrints():
    print("v2:", somePrints.iter)
    again(somePrints) 

Sardine will fail to update the function somePrints:

v1: 11

[Updating somePrints]

[Function exception | (somePrints)]

Traceback (most recent call last):

  File "/home/loig/Boulot/Recherche/live-coding/sardine/sardine_core/scheduler/async_runner.py", line 615, in _runner
    await self._run_once()
  File "/home/loig/Boulot/Recherche/live-coding/sardine/sardine_core/scheduler/async_runner.py", line 721, in _run_once
    await asyncio.create_task(
  File "/home/loig/Boulot/Recherche/live-coding/sardine/sardine_core/scheduler/async_runner.py", line 745, in _call_func
    return await maybe_coro(func, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/loig/Boulot/Recherche/live-coding/sardine/sardine_core/utils/__init__.py", line 77, in maybe_coro
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
TypeError: somePrints() got an unexpected keyword argument 'k'

[Saving somePrints from crash]

v1: 12

Started implementing a fix with 4e98343.