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.

Title: Change GeneratorExit's base class from Exception to BaseException
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: aegis, christian.heimes, gvanrossum, pitrou
Priority: normal Keywords: patch

Created on 2007-12-02 07:08 by aegis, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
GeneratorExit-BaseException.patch aegis, 2007-12-02 07:08
GeneratorExit-BaseException-2.patch aegis, 2007-12-02 20:07
Messages (11)
msg58079 - (view) Author: Chad Austin (aegis) Date: 2007-12-02 07:08
Per discussion at
December/075498.html, this patch changes GeneratorExit's base class 
from Exception to BaseException.

I updated the tests and documentation, but I may have missed any other 
discussion of GeneratorExit in the documentation.  Happy to update the 
patch if there is any feedback.
msg58083 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-02 12:06
Can you also add a comment to ./Doc/reference/expressions.rst and update
Misc/NEWS please? The rest of the patch is looking good.
msg58085 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2007-12-02 13:10
I'm not sure this change is necessary. Why don't you catch StandardError
instead of Exception? StandardError catches all Exception subtypes
except GeneratorExit, StopIteration and the various Warnings.
msg58086 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-02 13:28
You make a good point. Can you take it to the mailing list, please?
msg58096 - (view) Author: Chad Austin (aegis) Date: 2007-12-02 20:02
The mailing list discussion continues...  in the meantime, I will 
update the patch with your suggestions.

Can you describe to me what should change in Doc/reference/
expressions.rst?  It makes sense to remove the section in the example 
that says you should never catch GeneratorExit.  Should I mention 
anything about why?
msg58097 - (view) Author: Chad Austin (aegis) Date: 2007-12-02 20:07
New patch...
msg58138 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-12-03 19:05
looks good to me. Crys, can you do the honors?
msg58139 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-12-03 19:06
Oops, some tests fail. ctypes and hotshot at least.
msg58143 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-12-03 19:19
I take it back, that was a build error. After cleaning out the build
directory the hotshot and ctypes tests pass.
msg58151 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-03 20:03
Applied in r59300 to the trunk. (This time for real. At first I
committed it together with some junk to py3k branch. :/)
msg58152 - (view) Author: Chad Austin (aegis) Date: 2007-12-03 20:10
Fantastic, thank you!
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45878
2007-12-03 20:10:31aegissetmessages: + msg58152
2007-12-03 20:03:23christian.heimessetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg58151
2007-12-03 19:19:46gvanrossumsetmessages: + msg58143
2007-12-03 19:06:20gvanrossumsetmessages: + msg58139
2007-12-03 19:05:15gvanrossumsetnosy: + gvanrossum
resolution: accepted
messages: + msg58138
2007-12-02 20:07:35aegissetfiles: + GeneratorExit-BaseException-2.patch
messages: + msg58097
2007-12-02 20:02:54aegissetmessages: + msg58096
2007-12-02 13:28:53christian.heimessetmessages: + msg58086
2007-12-02 13:10:14pitrousetnosy: + pitrou
messages: + msg58085
2007-12-02 12:06:59christian.heimessetpriority: normal
assignee: christian.heimes
messages: + msg58083
keywords: + patch
nosy: + christian.heimes
2007-12-02 07:08:02aegiscreate