Repository navigation
Raise exceptions, don't throw #60918
Description
Activity
The proposed patch fixes wording of documentation, comments, etc which use the term 'throw' instead of 'raise' in context of exception raising.
- addeddocsDocumentation in the Doc dirDocumentation in the Doc dirtype-featureA feature request or enhancementA feature request or enhancement
on Dec 18, 2012 LGTM, except for:
diff -r 907d71668d3c Python/pythonrun.c --- a/Python/pythonrun.c Sun Dec 16 21:10:35 2012 +0100 +++ b/Python/pythonrun.c Tue Dec 18 19:35:27 2012 +0200 @@ -2518,7 +2518,7 @@ PyOS_CheckStack(void) { __try { - /* alloca throws a stack overflow exception if there's + /* alloca raises a stack overflow exception if there's not enough space left on the stack */ alloca(PYOS_STACK_MARGIN * sizeof(void*)); return 0;
This is talking about a C++ exception and therefore "throw" is correct.
Indeed. Here are updated patches.
New changeset fdf907708f49 by Andrew Svetlov in branch '3.2':
Issue bpo-16714: use 'raise' exceptions, don't 'throw'.
http://hg.python.org/cpython/rev/fdf907708f49New changeset 15a391919deb by Andrew Svetlov in branch '3.3':
Issue bpo-16714: use 'raise' exceptions, don't 'throw'.
http://hg.python.org/cpython/rev/15a391919debNew changeset 7260cf668dd7 by Andrew Svetlov in branch 'default':
Issue bpo-16714: use 'raise' exceptions, don't 'throw'.
http://hg.python.org/cpython/rev/7260cf668dd7New changeset 8c2635afbfe1 by Andrew Svetlov in branch '2.7':
Issue bpo-16714: use 'raise' exceptions, don't 'throw'.
http://hg.python.org/cpython/rev/8c2635afbfe1Fixed. Thanks, Serhiy.
I found one error. In Lib/email/header.py for 2.7 'raise' should be
reverted to 'throw'.Also I miss a past form. Second patch replaces 'threw' with 'raised'.
New changeset 0a5c5399f638 by Andrew Svetlov in branch '2.7':
revert comment wording (bpo-16714)
http://hg.python.org/cpython/rev/0a5c5399f638New changeset b227f8f7242d by Andrew Svetlov in branch '2.7':
replace threw with raised (bpo-16714)
http://hg.python.org/cpython/rev/b227f8f7242dNew changeset 74da2dbb5e50 by Andrew Svetlov in branch '3.2':
replace threw with raised (bpo-16714)
http://hg.python.org/cpython/rev/74da2dbb5e50New changeset 55d86476d048 by Andrew Svetlov in branch '3.3':
replace threw with raised (bpo-16714)
http://hg.python.org/cpython/rev/55d86476d048New changeset 3594175c6860 by Andrew Svetlov in branch 'default':
replace threw with raised (bpo-16714)
http://hg.python.org/cpython/rev/3594175c6860Committed. Thanks again, Serhiy!
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: