Open GoogleCodeExporter opened 9 years ago
I discovered an issue with this; rather than having ``'key' in
iniconfig.UndefinedSection`` or ``list(iniconfig.UndefinedSection)`` raise an
error as they currently do, it triggers a race condition, getting items 0, 1,
2, etc.
I discussed this at
http://stackoverflow.com/questions/4256357/how-to-override-python-listiterator-b
ehaviour and came up with the following solution.
The solution is overriding __iter__ in the Undefined class::
def __iter__(self):
"""Simple iterator which produces no output."""
return
yield
This makes ``list(iniconfig.UndefinedSection)`` return [] and makes ``'key' in
iniconfig.UndefinedSection`` return False as expected.
Original comment by chris.morganiser
on 23 Nov 2010 at 9:39
Original issue reported on code.google.com by
chris.morganiser
on 13 Nov 2010 at 12:30Attachments: