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-1047397: prevent repr/getattr exceptions in cgitb #15094

Closed
wants to merge 5 commits into from
Closed

bpo-1047397: prevent repr/getattr exceptions in cgitb #15094

wants to merge 5 commits into from

Conversation

RMJ10
Copy link

@RMJ10 RMJ10 commented Aug 3, 2019

Robin Becker's patch, slightly tweaked (for rotting) and tidied. Basically it wraps calls to getattr and repr while inspecting the code for which the traceback is being generated to prevent them from causing more exceptions.

https://bugs.python.org/issue1047397

Copy link
Member

@ethanfurman ethanfurman left a comment

Choose a reason for hiding this comment

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

We need a news entry (see the blurb tool).

Also, some tests would be good .

Lib/cgitb.py Outdated
return self.failval

def _pydoc_repr(value, sub='html'):
return getattr(pydoc, 'html').repr(value)
Copy link
Member

Choose a reason for hiding this comment

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

Should 'html' be sub instead?

Copy link
Author

Choose a reason for hiding this comment

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

Plausibly. I'll test it and see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants