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-43660: Fix crash when displaying exceptions with custom values for sys.stderr #25075

Merged
merged 3 commits into from Mar 29, 2021

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented Mar 29, 2021

Lib/test/test_sys.py Outdated Show resolved Hide resolved
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
# If the default displayhook doesn't take a strong reference
# to sys.stderr the following code can crash. See bpo-43660
# for more details.
code = """
Copy link
Member

@vstinner vstinner Mar 29, 2021

Choose a reason for hiding this comment

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

Could you please use textwrap.dedent() for that?

Copy link
Member Author

@pablogsal pablogsal Mar 29, 2021

Choose a reason for hiding this comment

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

Will do

Copy link
Member

@vstinner vstinner left a comment

LGTM, but I added a minor remark on the test ;-)

# to sys.stderr the following code can crash. See bpo-43660
# for more details.
code = textwrap.dedent('''
if True:
Copy link
Member

@vstinner vstinner Mar 29, 2021

Choose a reason for hiding this comment

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

thanks to dedent(), it can be removed ;-)

@pablogsal pablogsal merged commit 09b90a0 into python:master Mar 29, 2021
11 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented Mar 29, 2021

Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8, 3.9.
🐍🍒🤖

@pablogsal pablogsal deleted the bpo-43660 branch Mar 29, 2021
@bedevere-bot
Copy link

bedevere-bot commented Mar 29, 2021

GH-25083 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 29, 2021
…r sys.stderr (pythonGH-25075)

(cherry picked from commit 09b90a0)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
@bedevere-bot
Copy link

bedevere-bot commented Mar 29, 2021

GH-25084 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 29, 2021
…r sys.stderr (pythonGH-25075)

(cherry picked from commit 09b90a0)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
@miss-islington
Copy link
Contributor

miss-islington commented Mar 29, 2021

Sorry, @pablogsal, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 09b90a037d18f5d4acdf1b14082e57bda78e85d3 3.7

miss-islington added a commit that referenced this pull request Mar 29, 2021
…r sys.stderr (GH-25075)

(cherry picked from commit 09b90a0)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
pablogsal added a commit to pablogsal/cpython that referenced this pull request Mar 29, 2021
…ues for sys.stderr (pythonGH-25075).

(cherry picked from commit 09b90a0)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
@bedevere-bot
Copy link

bedevere-bot commented Mar 29, 2021

GH-25085 is a backport of this pull request to the 3.7 branch.

pablogsal added a commit that referenced this pull request Mar 29, 2021
…ues for sys.stderr (GH-25075). (GH-25085)

(cherry picked from commit 09b90a0)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
pablogsal added a commit that referenced this pull request Mar 29, 2021
…r sys.stderr (GH-25075) (GH-25083)

(cherry picked from commit 09b90a0)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
kreathon pushed a commit to kreathon/cpython that referenced this pull request May 2, 2021
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.

None yet

6 participants