pyreadline vi mode fix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

pyreadline vi mode fix

Michael Graz
Greetings all, LTNS.  When I enable vi mode (set_mode("vi") in ~/pyreadlineconfig.ini) there is an exception and then nothing works.  However there is an easy fix in rlmain.py function parse_and_bind.

before:

    except AttributeError:
        log('unknown func key="%s" func="%s"' % (key, func_name))
        print 'unknown function to bind: "%s"' % func_name
    self.mode._bind_key (key, func)

after:

    except AttributeError:
        log('unknown func key="%s" func="%s"' % (key, func_name))
        print 'unknown function to bind: "%s"' % func_name
        return
    self.mode._bind_key(key, func)

It is simply the addition of a return call in the exception handling block.  If there is no return then "func" is an undefined variable resulting in an exception in the statement: self.mode._bind_key(key, func)

    UnboundLocalError: local variable 'func' referenced before assignment

Would someone be able to checkin this fix?  Many thanks,
-Mike

(2nd attempt at mailing)

_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|

Re: pyreadline vi mode fix

Fernando Perez
On 7/19/07, Michael Graz <[hidden email]> wrote:
> Greetings all, LTNS.  When I enable vi mode (set_mode("vi") in
> ~/pyreadlineconfig.ini) there is an exception and then nothing works.
> However there is an easy fix in rlmain.py function parse_and_bind.

Thanks, Michael.  I see Jorgen already committed your fix.

Regards,

f
_______________________________________________
IPython-dev mailing list
[hidden email]
http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev