Skip to content

tuple excepts fail when one of the classes has type Any #1635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ddfisher opened this issue Jun 3, 2016 · 4 comments
Closed

tuple excepts fail when one of the classes has type Any #1635

ddfisher opened this issue Jun 3, 2016 · 4 comments

Comments

@ddfisher
Copy link
Collaborator

ddfisher commented Jun 3, 2016

from typing import Any

C = None   # type: Any
try:
    pass
except (C, Exception):
    pass

results in
test.py:6: error: Exception type must be derived from BaseException

@ddfisher
Copy link
Collaborator Author

ddfisher commented Jun 3, 2016

@pdmccormick

@gvanrossum
Copy link
Member

What's the purpose of C in the repro?

--Guido (mobile)
On Jun 3, 2016 12:49 PM, "David Fisher" notifications@github.com wrote:

@pdmccormick https://github.com/pdmccormick


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1635 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ACwrMhiyaIsITaVwrhe1SoIKXast4_nPks5qIIUzgaJpZM4It2ek
.

@ddfisher
Copy link
Collaborator Author

ddfisher commented Jun 3, 2016

I made a slight editing error as I was cleaning the example up. Fixed.

@ddfisher
Copy link
Collaborator Author

ddfisher commented Jun 3, 2016

This was broken in #1610.

pdmccormick added a commit to pdmccormick/mypy that referenced this issue Jun 3, 2016
pdmccormick added a commit to pdmccormick/mypy that referenced this issue Jun 3, 2016
ddfisher pushed a commit that referenced this issue Jun 3, 2016
* Allow `Any` types for tuple except handler tests

Fixes #1635.

* If even just one test has `Any` type then the whole expression will be `Any`

* Revert "If even just one test has `Any` type then the whole expression will be `Any`"

This reverts commit 00faff4.

* Ensure all errors are reported, regardless of where the `Any` appears
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants