FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-103578: Fix pdb reading code with non-utf8 encoding by gaogaotiantian · Pull Request #103581 · python/cpython · GitHub

Repository navigation

gh-103578: Fix pdb reading code with non-utf8 encoding - #103581

Merged
hauntsaninja merged 5 commits into
python:mainfrom
gaogaotiantian:pdb-encoding-issue
Apr 26, 2023
Merged

hauntsaninja merged 5 commits into
python:mainfrom
gaogaotiantian:pdb-encoding-issue

Conversation

gaogaotiantian commented Apr 16, 2023 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

pdb should use io.open_code to open code to avoid encoding issue.

hauntsaninja left a comment •
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for this PR!

We should probably mention in the news entry that because we use io.open_code, we'll now trigger auditing events hooks

hauntsaninja added the needs backport to 3.11 only security fixes label Apr 24, 2023

Copy link
Copy Markdown
Member Author

Thanks for this PR!

We should probably mention in the news entry that because we use io.open_code, we'll now trigger auditing events

io.open() also raise auditing events. According to the docs,

However, assuming that path is a str and an absolute path, open_code(path) should always behave the same as open(path, 'rb')

io.open_code() should behave the same as io.open(path, 'rb'), so is there an auditing event difference?

hauntsaninja commented Apr 24, 2023 •
edited
Loading

Copy link
Copy Markdown
Contributor

Ah, I meant the PyFile_SetOpenCodeHook() hook from PEP 578. I'm not sure what the best phrase is, but it was described as auditing event in #17127. Maybe "auditing hook" as per the PEP?
(that PR got regressed in #26992, this PR fixes :-) )

Copy link
Copy Markdown
Member Author

So it seems like changing it to io.open_code() makes it possible to call into the hook set by PyFile_SetOpenCodeHook()? Is that something expected in the news entry?

hauntsaninja commented Apr 24, 2023 •
edited
Loading

Copy link
Copy Markdown
Contributor

Yup! I think can't hurt to mention it in the news entry, since it is a (good) change in behaviour and one that seems potentially noteworthy.

Copy link
Copy Markdown
Member Author

Yup! I think can't hurt to mention it in the news entry, since it is a (good) change in behaviour and one that seems potentially noteworthy.

I updated the news entry. Let me know if you think that requires extra polish!

hauntsaninja left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks great, thanks!

hauntsaninja merged commit 31acfd7 into python:main Apr 26, 2023

Copy link
Copy Markdown
Contributor

Thanks @gaogaotiantian for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 26, 2023
…H-103581)

`pdb` should use `io.open_code` to open code to avoid encoding issue.
(cherry picked from commit 31acfd7)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>

Copy link
Copy Markdown

GH-103867 is a backport of this pull request to the 3.11 branch.

bedevere-bot removed the needs backport to 3.11 only security fixes label Apr 26, 2023
gaogaotiantian deleted the pdb-encoding-issue branch April 26, 2023 05:13
hauntsaninja pushed a commit that referenced this pull request Apr 26, 2023
) (#103867)

`pdb` should use `io.open_code` to open code to avoid encoding issue.
(cherry picked from commit 31acfd7)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
itamaro pushed a commit to itamaro/cpython that referenced this pull request Apr 26, 2023
…103581)

`pdb` should use `io.open_code` to open code to avoid encoding issue.

Copy link
Copy Markdown
Contributor

Thanks @gaogaotiantian for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

Copy link
Copy Markdown
Contributor

Thanks @gaogaotiantian for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

Copy link
Copy Markdown
Contributor

Thanks @gaogaotiantian for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

Copy link
Copy Markdown
Contributor

Sorry @gaogaotiantian and @hauntsaninja, I had trouble checking out the 3.8 backport branch.
Please retry by removing and re-adding the "needs backport to 3.8" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker 31acfd78a0810f84898d36a8289e407d3754b823 3.8

Copy link
Copy Markdown
Contributor

Sorry, @gaogaotiantian and @hauntsaninja, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 31acfd78a0810f84898d36a8289e407d3754b823 3.9

Copy link
Copy Markdown
Contributor

Sorry @gaogaotiantian and @hauntsaninja, I had trouble checking out the 3.10 backport branch.
Please retry by removing and re-adding the "needs backport to 3.10" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker 31acfd78a0810f84898d36a8289e407d3754b823 3.10

Copy link
Copy Markdown
Contributor

Thanks @gaogaotiantian for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

Copy link
Copy Markdown
Contributor

Sorry, @gaogaotiantian and @hauntsaninja, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 31acfd78a0810f84898d36a8289e407d3754b823 3.10

zooba commented Apr 27, 2023

Copy link
Copy Markdown
Member

No backport needed - this was fine in 3.8-3.10 and was regressed in 3.11.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

5 participants


Back | FazBrowse Home | New Git URL