Skip to content
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

bpo-30579: Allow TracebackType creation and tb_next mutation from Python #4793

Merged
merged 1 commit into from
Jan 7, 2018

Conversation

njsmith
Copy link
Contributor

@njsmith njsmith commented Dec 11, 2017

Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change itself looks good to me, but the remaining assert statements in the test case need to be converted to the appropriate unittest methods: https://docs.python.org/3/library/unittest.html#assert-methods

except Exception as exc:
tb = exc.__traceback__

assert isinstance(tb.tb_next, types.TracebackType)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These assertions all need to use the unittest assert methods, not assert statements.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@njsmith
Copy link
Contributor Author

njsmith commented Jan 6, 2018

Whoops, good catch, thanks.

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@ncoghlan: please review the changes made to this pull request.

Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly looks good to me now, just a minor comment relating to the possible use of assertIsInstance for slightly nicer failure messages.

Marking my review as approved anyway though, as I'll be offline until tomorrow, and I'm fine with someone else merging this in the meantime :)

except Exception as exc:
tb = exc.__traceback__

self.assertTrue(isinstance(tb.tb_next, types.TracebackType))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a dedicated method for this one that gives a nicer message when it fails: https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertIsInstance

@njsmith
Copy link
Contributor Author

njsmith commented Jan 7, 2018

Well that's embarrassing -- I even looked for assertIsInstance and somehow concluded it didn't exist. Fixed now.

@ncoghlan ncoghlan merged commit e46a8af into python:master Jan 7, 2018
@njsmith njsmith deleted the bpo-30579 branch January 18, 2018 07:55
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.

4 participants