[issue4806] Function calls taking a generator as star argument can mask TypeErrors in the generator

Martin Panter report at bugs.python.org
Tue Feb 24 05:29:14 CET 2015


Martin Panter added the comment:

I am posting a new version of Daniel’s patch as issue4806-star-TypeError.v2.patch:

* Merged with recent “default” (3.5) branch
* Dropped the documentation fix, since revision a8aa918041c2 already fixed that in an identical fashion
* Changed to a “look before you leap” style check before attempting PySequence_Tuple(). This way we get to keep other valid errors such as “iter() returned non-iterator”.

I am comfortable with the code changes previous patch as well as mine. Checking the “tp_iter” field and PySequence_Check() is basically what happens behind the scenes, via PyObject_GetIter() anyway. So I think either patch is valid and a worthwhile improvement.

----------
Added file: http://bugs.python.org/file38219/issue4806-star-TypeError.v2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4806>
_______________________________________


More information about the Python-bugs-list mailing list