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 steven.daprano
Recipients eric.smith, steven.daprano, thautwarm, vtheno athena
Date 2018-10-03.15:36:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20181003153649.GL21220@ando.pearwood.info>
In-reply-to <1538574959.99.0.545547206417.issue34880@psf.upfronthosting.co.za>
Content
On Wed, Oct 03, 2018 at 01:56:00PM +0000, Eric V. Smith wrote:
> I think this is a bug that should be fixed.

Supporting this position, shadowing other exceptions doesn't change the 
exception generated by the interpreter:

py> TypeError = None
py> 1 + "a"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'

On the other hand, this has been the behaviour going back to Python 1.5, 
it is hard to see why this is worse than any other example of shadowing. 
I don't think there's anything in the documentation that says that 
assert *shouldn't* do a LOAD_GLOBAL on AssertionError.

Hence this would be an enhancement rather than a bug fix.

> And, I think a broader discussion on python-dev might be useful, too, 
> in order to get more opinions.

I agree. I think we need to clarify the intent here, and then decide 
that if it is a bug, should we bother fixing it in pre-3.8 versions?
History
Date User Action Args
2018-10-03 15:36:57steven.dapranosetrecipients: + steven.daprano, eric.smith, thautwarm, vtheno athena
2018-10-03 15:36:57steven.dapranolinkissue34880 messages
2018-10-03 15:36:57steven.dapranocreate