[IPython-dev] svnversion used for Release.py

Fernando Perez fperez.net at gmail.com
Wed Nov 29 00:00:04 CST 2006


On 11/28/06, R. Bernstein <rocky at panix.com> wrote:
> Before you go offline and before the next ipython release comes out,
> it would be good to get this from
>   http://projects.scipy.org/pipermail/ipython-dev/2006-October/002413.html
> cleared up. Thanks ...
>
> ----
>
> One last strongly related topic which includes Fernando's comment about
> the necessity of Python 2.4 support. It was the following readline
> workaround in Debugger.py around line 68 that caused me to initially
> decided to punt on Python < 2.5:
>
>
>     if sys.version[:3] >= '2.5':
>         def __init__(self,color_scheme='NoColor',completekey=None,
>                      stdin=None, stdout=None):
>             ... # I'll come back to this below
>     else:
>         # Ugly hack: for Python 2.3-2.4, we can't call the parent constructor,
>         # because it binds readline and breaks tab-completion.  This means we
>         # have to COPY the constructor here.
>         def __init__(self,color_scheme='NoColor'):
>         ... #1
>
> I think the intent at #1 above is basically to copy the code in pdb's
> __init__ constructor omitting "import readline" and the code associated
> with implications of that.
>
> So it looks to me like the test on version 2.5 has more to do with
> testing the version of *pdb* used than anything else version 2.4 or
> version 2.5. Is this correct?
>
> Assuming this is the case, when I look the 2.4 pdb versus the 2.5 pdb,
> I see THAT THEY BOTH IMPORT READLINE. In other words the 2.5 branch
> ("I'll come back to this below") should have pdb code copied minus the
> import readline. This has to be a separate branch still because it is
> different code. But none of it appears, so I'd be curious to learn why
> it's not needed in the 2.5 branch.

No, the problem is a bit more subtle than that: it's not the 'import
readline' that causes problems, but rather the fact that the
constructor fires this call:

2.4:
class Pdb(bdb.Bdb, cmd.Cmd):

    def __init__(self):
        bdb.Bdb.__init__(self)
        cmd.Cmd.__init__(self)

2.5:
class Pdb(bdb.Bdb, cmd.Cmd):

    def __init__(self, completekey='tab', stdin=None, stdout=None):
        bdb.Bdb.__init__(self)
        cmd.Cmd.__init__(self, completekey, stdin, stdout)

The critical difference is that the 2.5 constructor exposes the
'completekey' parameter publicly, and correctly passes it down to the
cmd.Cmd constructor, so we can nicely override it to None and avoid
any readline-related misconfiguration issues.  Prior to 2.5, this
parameter was not accessible from the Pdb constructor and the default
value of 'tab' would always fire.


Does that help?

Cheers,

f


More information about the IPython-dev mailing list