This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2009年02月11日 19:32 by gpolo, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| check_before_overriding.diff | gpolo, 2009年02月11日 21:34 | review | ||
| Messages (7) | |||
|---|---|---|---|
| msg81657 - (view) | Author: Guilherme Polo (gpolo) * (Python committer) | Date: 2009年02月11日 19:32 | |
Hi, I find it weird that given this sample code: def g(): yield iter(None) list(*g()) I get this traceback: Traceback (most recent call last): File "a1.py", line 3, in <module> list(*g()) TypeError: type object argument after * must be a sequence, not generator At a minimum the exception message looks awkward to me. With the proposed patch, the new traceback would be: Traceback (most recent call last): File "a1.py", line 3, in <module> list(*g()) File "a1.py", line 2, in g yield iter(None) TypeError: 'NoneType' object is not iterable |
|||
| msg81658 - (view) | Author: Guilherme Polo (gpolo) * (Python committer) | Date: 2009年02月11日 19:35 | |
(Btw, the suggestion to check for tp_iter came from Antoine Pitrou. It seemed fine to me.) |
|||
| msg81659 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2009年02月11日 19:41 | |
You must check tp_iter as well, not only Py_TPFLAGS_HAVE_ITER. Py_TPFLAGS_HAVE_ITER only tells you that the tp_iter field exists, not that it's non-NULL. (see the code for PyObject_GetIter() in Objects/abstract.c for an example) |
|||
| msg81675 - (view) | Author: Guilherme Polo (gpolo) * (Python committer) | Date: 2009年02月11日 21:34 | |
Thanks for taking a look, my bad for taking so long to reply. I'm adding a new patch now. This one, besides the fix needed mentioned above, disregards tp_iter from old class instances (since they are always available and tell us nothing). |
|||
| msg119296 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2010年10月21日 13:47 | |
Is this ready to commit? |
|||
| msg151111 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2012年01月12日 04:52 | |
See also Issue 4806 |
|||
| msg152581 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2012年02月04日 02:27 | |
This is one of 4 duplicate issues, 3 with somewhat similar patches, with nearly disjoint nosy lists. Consolidating. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:45 | admin | set | github: 49468 |
| 2012年02月04日 02:27:29 | terry.reedy | set | status: open -> closed superseder: Function calls taking a generator as star argument can mask TypeErrors in the generator versions: + Python 3.2, Python 3.3, - Python 3.1 nosy: + terry.reedy messages: + msg152581 resolution: duplicate |
| 2012年01月12日 04:52:43 | martin.panter | set | nosy:
+ martin.panter messages: + msg151111 |
| 2010年12月15日 20:41:39 | pitrou | set | assignee: pitrou -> nosy: georg.brandl, pitrou, gpolo |
| 2010年10月21日 13:47:47 | georg.brandl | set | assignee: pitrou messages: + msg119296 nosy: + georg.brandl |
| 2009年02月13日 17:50:47 | gpolo | set | files: - check_tpiter_before_overriding_msg.diff |
| 2009年02月11日 21:34:32 | gpolo | set | files:
+ check_before_overriding.diff messages: + msg81675 |
| 2009年02月11日 19:41:44 | pitrou | set | nosy:
+ pitrou messages: + msg81659 |
| 2009年02月11日 19:35:28 | gpolo | set | messages: + msg81658 |
| 2009年02月11日 19:34:18 | gpolo | set | type: behavior components: + Interpreter Core versions: + Python 3.1, Python 2.7 |
| 2009年02月11日 19:32:42 | gpolo | create | |