-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
gh-117535: Do not try to get the source line for file "sys" in warnings #117550
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
Conversation
The |
I think this is not the right place. It should be handled in the same way as names like |
Hmm, I kind of disagree. |
Well, then we should use something else than |
We can, but that's actually more risky. We use the string
Simply changing it to
So we need to secretly translate it back to The worst part is, we allow users to overwrite the format part, and their formatting will be broken without knowing the fact. From the reason above, I don't believe changing it to |
The "sys" default was introduced in 11a8966, related issue #77556. Neither the issue nor the related PR sheds light on why this particular default was chosen. I agree with @serhiy-storchaka that the default name is not a good one because it doesn't clearly communicate that the name does not refer to a real file. Changing "sys" to " |
@ronaldoussoren, I fixed formatting in your comment, because unquoted |
I'm not worried about the filter for warnings, mostly breaking people's test cases. Changing the output message could potentially break tests, considering this is the format for about 6 years. However, I don't think changing Also it's just a question. I don't have a very good alternate here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve it because it is the best solution that can be backported. But I think that we should do better in "main".
Sure that makes sense. So what do we want for this PR? Do we want to merge + backport it, then leave the issue open and figure out a better idea for main, or do we want to make a decision about main now and fix both main and older version together? |
Hi @serhiy-storchaka , how do you want to proceed this issue? This is a fix that can be backported, and you proposed to change the filename to |
If we apply this first, the following PR will need to revert these changes completely. I think it is better to make this a backport only PR. |
I made a PR #118014 for 3.12. 3.11 is security fix only now so I won't bother. I'll make another one to replace |
#118018 is the PR for main, which replaced |
"sys"
is a makeup filename inso we should never try to get the source code for it. Otherwise if there happens to be a
sys
file insys.path
, the first line will be displayed.We can use something else than
sys
to be special, but there's always the issue with name conflict. I don't believe there's a reasonable case wheresys
is actually needed as the source file so this should be safe.Not sure if this is worth a regression test - it's relatively rare and the problem is kind of benign. I can add some if people think it's required.