[Fixed] Error using argument named length in closure

Using length as the name of an argument in a class method that uses length in a closure fails.

The workaround is easy: name the argument length_.

To reproduce the error type the following code in a form, before class Form1 and execute:

class C:
  def m1(self, x, length):
    print x, length

  def m2(self, x, length):
    print x, length
    def f():
      a = x
      b = length

C().m1(1, 2)
C().m2(1, 2)

The output window should show:

1 2
1 2

Instead it shows:

1 2
1

Nice catch! That’s a bug in Skulpt – moved to Bug Reports.