Skip to content

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

Closed
RMJ10 wants to merge 5 commits into
python:masterfrom
RMJ10:fix-issue-1047397
Closed

bpo-1047397: prevent repr/getattr exceptions in cgitb#15094
RMJ10 wants to merge 5 commits into
python:masterfrom
RMJ10:fix-issue-1047397

Conversation

@RMJ10

@RMJ10 RMJ10 commented Aug 3, 2019

Copy link
Copy Markdown

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

@ethanfurman ethanfurman left a comment

Copy link
Copy Markdown
Member

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 .

Comment thread Lib/cgitb.py Outdated
return self.failval

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

Copy link
Copy Markdown
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
Copy Markdown
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.

5 participants