##// END OF EJS Templates
Fix warnings about ignored GeneratorExit exceptions under Python 2.5+ in ipipe.xrepr()....
Walter Doerwald -
Show More
@@ -114,6 +114,11 b' except NameError:'
114 items.reverse()
114 items.reverse()
115 return items
115 return items
116
116
117 try: # Python 2.4 compatibility
118 GeneratorExit
119 except NameError:
120 GeneratorExit = SystemExit
121
117 try:
122 try:
118 import pwd
123 import pwd
119 except ImportError:
124 except ImportError:
@@ -666,7 +671,7 b' def xrepr(item, mode="default"):'
666 try:
671 try:
667 for x in func(mode):
672 for x in func(mode):
668 yield x
673 yield x
669 except (KeyboardInterrupt, SystemExit):
674 except (KeyboardInterrupt, SystemExit, GeneratorExit):
670 raise
675 raise
671 except Exception:
676 except Exception:
672 yield (astyle.style_default, repr(item))
677 yield (astyle.style_default, repr(item))
@@ -840,20 +845,20 b' def upgradexattr(attr):'
840 """
845 """
841 Convert an attribute descriptor string to a real descriptor object.
846 Convert an attribute descriptor string to a real descriptor object.
842
847
843 If attr already is a descriptor object return if unmodified. A
848 If attr already is a descriptor object return it unmodified. A
844 ``SelfDescriptor`` will be returned if ``attr`` is ``None``. ``"foo"``
849 ``SelfDescriptor`` will be returned if ``attr`` is ``None``. ``"foo"``
845 returns an ``AttributeDescriptor`` for the attribute named ``"foo"``.
850 returns an ``AttributeDescriptor`` for the attribute named ``"foo"``.
846 ``"foo()"`` returns a ``MethodDescriptor`` for the method named ``"foo"``.
851 ``"foo()"`` returns a ``MethodDescriptor`` for the method named ``"foo"``.
847 ``"-foo"`` will return an ``IterAttributeDescriptor`` for the attribute
852 ``"-foo"`` will return an ``IterAttributeDescriptor`` for the attribute
848 named ``"foo"`` and ``"-foo()"`` will return an ``IterMethodDescriptor``
853 named ``"foo"`` and ``"-foo()"`` will return an ``IterMethodDescriptor``
849 for the method named ``"foo"``. Furthermore integer will return the appropriate
854 for the method named ``"foo"``. Furthermore integers will return the appropriate
850 ``IndexDescriptor`` and callables will return a ``FunctionDescriptor``.
855 ``IndexDescriptor`` and callables will return a ``FunctionDescriptor``.
851 """
856 """
852 if attr is None:
857 if attr is None:
853 return selfdescriptor
858 return selfdescriptor
854 elif isinstance(attr, Descriptor):
859 elif isinstance(attr, Descriptor):
855 return attr
860 return attr
856 elif isinstance(attr, str):
861 elif isinstance(attr, basestring):
857 if attr.endswith("()"):
862 if attr.endswith("()"):
858 if attr.startswith("-"):
863 if attr.startswith("-"):
859 return IterMethodDescriptor(attr[1:-2])
864 return IterMethodDescriptor(attr[1:-2])
General Comments 0
You need to be logged in to leave comments. Login now