Skip to content

traceback.print_exception(): Arguments optional in Python 3 #1982

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

Merged
merged 1 commit into from
Mar 29, 2018

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Mar 23, 2018

The first two arguments were already optional for Python 2, but they are also optional in Python 3:

>>> import traceback
>>> traceback.print_exception(None, None, None)
NoneType: None

This should fix mypy warnings in the following line: print_exception(*sys.exc_info()) (untested).

@srittau
Copy link
Collaborator Author

srittau commented Mar 23, 2018

The travis checks fail, because mypy itself has the problem outlined above and currently has a type ignore comment to disable it. In lines 185-187 of mypy/dmypy_server.py:

            exc_info = sys.exc_info()
            if exc_info[0] and exc_info[0] is not SystemExit:
                traceback.print_exception(*exc_info)  # type: ignore

@JelleZijlstra JelleZijlstra merged commit 0170e6d into python:master Mar 29, 2018
@srittau srittau deleted the print-exception branch March 29, 2018 01:52
yedpodtrzitko pushed a commit to yedpodtrzitko/typeshed that referenced this pull request Jan 23, 2019
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

Successfully merging this pull request may close these issues.

2 participants