(1) Please use the SF patch manager. (2) Please don't propose adding more bare "except:" clauses to the standard library.
(3) I think a better patch is to use str(word)[:n] instead of word[:n]. On 8/14/05, Michael Krasnyk <[EMAIL PROTECTED]> wrote: > Hello all, > > Recently I've found that rlcompleter does not work correctly with SWIG > generated classes. > In some cases dir(object) containes not only strings, but also type of > the object, smth like <class 'mywrapper.IClassPtr'>. > And condition "word[:n] == attr" throws an exception. > Is it possible to solve this problem with following path? > > --- cut --- > --- rlcompleter.py.org 2005-08-14 13:02:02.000000000 +0200 > +++ rlcompleter.py 2005-08-14 13:18:59.000000000 +0200 > @@ -136,8 +136,11 @@ > matches = [] > n = len(attr) > for word in words: > - if word[:n] == attr and word != "__builtins__": > - matches.append("%s.%s" % (expr, word)) > + try: > + if word[:n] == attr and word != "__builtins__": > + matches.append("%s.%s" % (expr, word)) > + except: > + pass > return matches > > def get_class_members(klass): > --- cut --- > > Thanks in advance, > Michael Krasnyk > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com