[Python-checkins] r56421 - in sandbox/trunk/2to3: fixes/fix_stringio.py fixes/util.py
collin.winter
python-checkins at python.org
Tue Jul 17 23:10:10 CEST 2007
Author: collin.winter
Date: Tue Jul 17 23:10:09 2007
New Revision: 56421
Modified:
sandbox/trunk/2to3/ (props changed)
sandbox/trunk/2to3/fixes/fix_stringio.py
sandbox/trunk/2to3/fixes/util.py
Log:
Have fixes.util.attr_chain() yield the starting object (useful for some other fixers).
Modified: sandbox/trunk/2to3/fixes/fix_stringio.py
==============================================================================
--- sandbox/trunk/2to3/fixes/fix_stringio.py (original)
+++ sandbox/trunk/2to3/fixes/fix_stringio.py Tue Jul 17 23:10:09 2007
@@ -40,7 +40,7 @@
match = super(FixStringio, self).match
results = match(node)
if results:
- if any([match(obj) for obj in attr_chain(node, "parent")]):
+ if any([match(obj) for obj in attr_chain(node.parent, "parent")]):
return False
return results
return False
Modified: sandbox/trunk/2to3/fixes/util.py
==============================================================================
--- sandbox/trunk/2to3/fixes/util.py (original)
+++ sandbox/trunk/2to3/fixes/util.py Tue Jul 17 23:10:09 2007
@@ -169,6 +169,7 @@
Yields:
Each successive object in the chain.
"""
+ yield obj
next = getattr(obj, attr)
while next:
yield next
More information about the Python-checkins
mailing list