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 2012年05月25日 11:02 by kristjan.jonsson, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| throw27.diff | kristjan.jonsson, 2014年02月03日 15:19 | |||
| 3x.diff | kristjan.jonsson, 2014年02月03日 15:57 | review | ||
| throw-3x.v2.patch | martin.panter, 2015年12月05日 01:23 | For Python 3 | ||
| throw-3x.v3.patch | martin.panter, 2015年12月19日 01:21 | review | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 32207 | merged | dpg, 2022年03月31日 00:58 | |
| PR 32213 | merged | miss-islington, 2022年03月31日 13:57 | |
| PR 32214 | merged | miss-islington, 2022年03月31日 13:57 | |
| Messages (16) | |||
|---|---|---|---|
| msg161565 - (view) | Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) | Date: 2012年05月25日 11:02 | |
the documentation for generator.throw() does not mention the fact that it has the same semantics for the three arguments as a "raise" expression has. The first two arguments can be: throw(exc_type, None) throw(exc_type, value) throw(exc_type, exc_instance) throw(exc_instance, None) |
|||
| msg209836 - (view) | Author: Yury Selivanov (yselivanov) * (Python committer) | Date: 2014年01月31日 22:11 | |
Kristjan, can you write a patch for this? |
|||
| msg210139 - (view) | Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) | Date: 2014年02月03日 15:19 | |
Here's one for 2.7. I'm still looking at 3. The funny thing is that the signature of generator.throw reflects 2.x conventions. I'm figuring out if it can be used with the .with_traceback() idiom |
|||
| msg210146 - (view) | Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) | Date: 2014年02月03日 15:57 | |
And 3.x |
|||
| msg210150 - (view) | Author: Yury Selivanov (yselivanov) * (Python committer) | Date: 2014年02月03日 17:35 | |
I like the patches, except the example in 3x.diff. Please see the review. |
|||
| msg210188 - (view) | Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) | Date: 2014年02月04日 09:45 | |
Note that the docstring does not match the doc: PyDoc_STRVAR(throw_doc, "throw(typ[,val[,tb]]) -> raise exception in generator,\n\ return next yielded value or raise StopIteration."); Should I change the docstring too? |
|||
| msg245559 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2015年06月20日 12:00 | |
See Issue 13213 for some analysis of the behaviour of different combinations of arguments. The docstring should be changed if necessary, but in this case I don’t see what needs changing. The argument names perhaps, just for consistency’s sake? |
|||
| msg254824 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2015年11月18日 00:00 | |
I can’t really comment on the 2.7 version, because I’m not too familiar with Python 2 exceptions. For Python 3, is there any reason to bless the None, tuple or non-exception cases as the exception "value" argument? IMO these just make things too complicated without any benefit. Changes I would make to the patch: * Only mention that "value" can be omitted, or it can be an instance of the class specified by "type". Drop mentioning the None option, and the single or tuple constructor argument options. It looks like the tuple option actually gets expanded to multiple constructor arguments?! * Mention that if "value" is passed, its traceback could be lost * Drop the example, unless someone can come up with a concise and realistic example * Unify with definition for coroutines <https://docs.python.org/dev/reference/datamodel.html#coroutine.throw> * Change the doc string(s) to match the argument names, but don’t bother copying the full definition text |
|||
| msg255913 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2015年12月05日 01:23 | |
Changes in throw-3x.v2.patch: * Split into two signatures * Added parallel coroutine.throw(value) signature * *Value* should be an exception instance; drop mentioning other options * Default value is instantiated from *type* * __traceback__ can be cleared * Dropped the example * Update generator and coroutine doc strings with double signatures |
|||
| msg256627 - (view) | Author: Yury Selivanov (yselivanov) * (Python committer) | Date: 2015年12月17日 23:32 | |
Martin, could you please rebase your patch on top of recent cpython default branch, so that a 'review' link appears? |
|||
| msg256716 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2015年12月19日 01:21 | |
This one is based on the public 3.5 branch, so should work. I corrected a small typo made in the previous patch. |
|||
| msg327913 - (view) | Author: Cheryl Sabella (cheryl.sabella) * (Python committer) | Date: 2018年10月17日 22:00 | |
It seems that this patch was close to being merged. Would it be helpful for me to create a PR for it over 3.8? Thanks! |
|||
| msg414774 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2022年03月08日 21:03 | |
This still hasn't been fixed. I suspect that a new patch should be produced and uploaded as a PR. It looks pretty simple. |
|||
| msg416436 - (view) | Author: Andrew Svetlov (asvetlov) * (Python committer) | Date: 2022年03月31日 13:57 | |
New changeset 8be7c2bc5ad5e295f0f855bb31db412eef2c7c92 by Dave Goncalves in branch 'main': bpo-14911: Corrected generator.throw() documentation (GH-32207) https://github.com/python/cpython/commit/8be7c2bc5ad5e295f0f855bb31db412eef2c7c92 |
|||
| msg416437 - (view) | Author: miss-islington (miss-islington) | Date: 2022年03月31日 14:23 | |
New changeset 625f6704c0d783360574bbab2f78b0b9bbed5891 by Miss Islington (bot) in branch '3.10': bpo-14911: Corrected generator.throw() documentation (GH-32207) https://github.com/python/cpython/commit/625f6704c0d783360574bbab2f78b0b9bbed5891 |
|||
| msg416438 - (view) | Author: miss-islington (miss-islington) | Date: 2022年03月31日 14:24 | |
New changeset 98d57737de73342d33d1b90dc0285f586465d22b by Miss Islington (bot) in branch '3.9': bpo-14911: Corrected generator.throw() documentation (GH-32207) https://github.com/python/cpython/commit/98d57737de73342d33d1b90dc0285f586465d22b |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:30 | admin | set | github: 59116 |
| 2022年03月31日 14:29:37 | asvetlov | set | status: open -> closed stage: patch review -> resolved resolution: fixed versions: - Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8 |
| 2022年03月31日 14:24:43 | miss-islington | set | messages: + msg416438 |
| 2022年03月31日 14:23:12 | miss-islington | set | messages: + msg416437 |
| 2022年03月31日 13:57:29 | miss-islington | set | pull_requests: + pull_request30290 |
| 2022年03月31日 13:57:24 | miss-islington | set | nosy:
+ miss-islington pull_requests: + pull_request30289 |
| 2022年03月31日 13:57:02 | asvetlov | set | nosy:
+ asvetlov messages: + msg416436 |
| 2022年03月31日 00:58:19 | dpg | set | nosy:
+ dpg pull_requests: + pull_request30282 |
| 2022年03月08日 21:03:55 | gvanrossum | set | versions:
+ Python 3.7, Python 3.8, Python 3.9, Python 3.10, Python 3.11 nosy: + gvanrossum messages: + msg414774 keywords: + easy |
| 2018年10月17日 22:00:32 | cheryl.sabella | set | nosy:
+ cheryl.sabella messages: + msg327913 |
| 2015年12月19日 01:21:05 | martin.panter | set | files:
+ throw-3x.v3.patch messages: + msg256716 versions: - Python 3.4 |
| 2015年12月17日 23:32:21 | yselivanov | set | messages: + msg256627 |
| 2015年12月05日 01:23:11 | martin.panter | set | files:
+ throw-3x.v2.patch messages: + msg255913 |
| 2015年11月18日 00:00:32 | martin.panter | set | messages:
+ msg254824 stage: needs patch -> patch review |
| 2015年06月20日 12:02:41 | martin.panter | link | issue13213 superseder |
| 2015年06月20日 12:00:48 | martin.panter | set | nosy:
+ martin.panter messages: + msg245559 versions: + Python 3.4, Python 3.5, Python 3.6, - Python 3.2, Python 3.3 |
| 2014年02月04日 09:45:12 | kristjan.jonsson | set | messages: + msg210188 |
| 2014年02月03日 17:35:14 | yselivanov | set | messages: + msg210150 |
| 2014年02月03日 15:57:37 | kristjan.jonsson | set | files:
+ 3x.diff messages: + msg210146 |
| 2014年02月03日 15:19:58 | kristjan.jonsson | set | files:
+ throw27.diff keywords: + patch messages: + msg210139 |
| 2014年01月31日 22:11:27 | yselivanov | set | nosy:
+ yselivanov messages: + msg209836 |
| 2012年05月25日 18:42:09 | eric.araujo | set | stage: needs patch versions: - Python 3.1, Python 3.4 |
| 2012年05月25日 11:02:16 | kristjan.jonsson | create | |