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-1514420: Do not attempt to open files with names in <>s when form… #28143

Merged
merged 3 commits into from
Sep 20, 2021

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Sep 3, 2021

…atting an exception

https://bugs.python.org/issue1514420

@iritkatriel iritkatriel requested a review from vstinner September 3, 2021 16:18
@iritkatriel
Copy link
Member Author

iritkatriel commented Sep 3, 2021

@vstinner I tested this manually (I created a file called <stdin> with some text in it and saw that it no longer displays this text). I'm not sure how to write a unit test though.

@ambv
Copy link
Contributor

ambv commented Sep 17, 2021

I think this is worth having even without a specific unit test as it's mimicking linecache's tested behavior anyway. Since the work is done already, we could just merge it and close the issue if CI's green.

@ambv ambv added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Sep 17, 2021
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @ambv for commit 945149c 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Sep 17, 2021
@ambv ambv merged commit f71300c into python:main Sep 20, 2021
@vstinner
Copy link
Member

Usually, reading the first character of a string is unsafe if the string length is not checked, but PyUnicode_READ_CHAR(filename, 0) is safe for an empty string because CPython strings always with a null character, even for the empty string ;-)

niyas-sait pushed a commit to niyas-sait/cpython that referenced this pull request Sep 21, 2021
…atting an exception (pythonGH-28143)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
@iritkatriel iritkatriel deleted the bpo-1514420 branch November 5, 2021 09:54
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