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.

Author terry.reedy
Recipients Jocjo, Ramchandra Apte, ezio.melotti, loewis, mark.dickinson, roger.serwy, terry.reedy
Date 2012-11-23.19:54:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1353700451.81.0.0981315783992.issue16491@psf.upfronthosting.co.za>
In-reply-to
Content
I marked this as 3.3+ bug because double reporting is new in 3.x and 'from None' is new in 3.3 (it causes a TypeError in the raise statement ;-).

Command prompt output appears 'correct' (as intended).
[I added blank lines before each try: for reading ease]

Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17)
 [MSC v.1600 64 bit (AMD64)] on win32

>>> try:
...     1/0
... except ZeroDivisionError as exp:
...     raise TypeError('Divided by 0')
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
TypeError: Divided by 0

>>> try:
...     1/0
... except ZeroDivisionError as exp:
...     raise TypeError('Divided by 0') from exp
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ZeroDivisionError: division by zero

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
TypeError: Divided by 0

>>> try:
...     1/0
... except ZeroDivisionError as exp:
...     raise TypeError('Divided by 0') from None
...
Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
TypeError: Divided by 0

---------------------------------------------------
In IDLE on Win 7 64, all three give
Traceback (most recent call last):
  File "F:\Python\mypy\tem.py", line 4, in <module>
    raise TypeError('Divided by 0')  # except for change here
TypeError: Divided by 0

We need to see non-Windows IDLE output to see if problem is limited to running with pythonw. Here is copy-paste code.

try:
    1/0
except ZeroDivisionError as exp:
    raise TypeError('Divided by 0') from None
History
Date User Action Args
2012-11-23 19:54:11terry.reedysetrecipients: + terry.reedy, loewis, mark.dickinson, ezio.melotti, roger.serwy, Ramchandra Apte, Jocjo
2012-11-23 19:54:11terry.reedysetmessageid: <1353700451.81.0.0981315783992.issue16491@psf.upfronthosting.co.za>
2012-11-23 19:54:11terry.reedylinkissue16491 messages
2012-11-23 19:54:11terry.reedycreate