#48 psyco-1.4's psyobj and default parameter value

closed-fixed
nobody
None
5
2005-02-14
2005-02-11
No

Hi,

I've recently upgraded to psyco1.4 and I noticed some
one unit test of my program no longer passes. It does
without psyco of with psyco 1.3, so this is most
certainly a regression in psyco 1.4 (or an agressive
optimisation).

The attached file reproduces the problem. Running it
outputs

Traceback (most recent call last):
File "<stdin>", line 19, in ?
File "<stdin>", line 7, in solve_one
File "<stdin>", line 11, in solve_one
TypeError: _solve() takes exactly 3 arguments (2 given)

Removing the psyobj parent class or using psyco-1.3
will give a correct behaviour. Using psyco-1.4 and
psyco.full() without deriving from psyobj will also
give a correct behaviour.

Discussion

  • Alexandre Fayolle

    script showing the bug

     
  • Alexandre Fayolle

    Logged In: YES
    user_id=116727

    Adrien Di Mascio did some further investigation. It looks
    like the proxy() function looses the default values of
    function parameters.

    >>> from psyco import proxy
    >>> def f(a=1): pass
    ...
    >>> f.func_defaults
    (1,)
    >>> f = proxy(f)u
    >>> f.func_defaults

    But you can still somehow call the function normally

    >>> f()

    However calling the proxied function from another proxied
    function fails:

    from psyco import proxy

    def f():
    g()

    def g(a=1):
    print a

    if __name__ == '__main__':
    f = proxy(f)
    g = proxy(g)
    f()

     
  • Armin Rigo

    Armin Rigo - 2005-02-14

    Logged In: YES
    user_id=4771

    That's indeed a simple but mean bug. Fixed. Looks like it
    is soon time for Psyco 1.5...

     
  • Armin Rigo

    Armin Rigo - 2005-02-14
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks