Skip to content

Conversation

@gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented Apr 18, 2024

The filename sys could be a real file in the file system and linecache will try to read the content of the file and print it out. Using <sys> will avoid the confusion and let linecache know this is not a real file.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

While we are here, I suggest to set lineno to 0 in this case.

@gaogaotiantian
Copy link
Member Author

While we are here, I suggest to set lineno to 0 in this case.

Ah, right. Done.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

I always thought this referred to the sys module.

@gaogaotiantian
Copy link
Member Author

Maybe we can merge this now consider this is a straightfoward fix and we already have 2 approvals?

@JelleZijlstra JelleZijlstra merged commit a09e472 into python:main Apr 19, 2024
@gaogaotiantian gaogaotiantian deleted the fix-sys-warning-main branch April 19, 2024 04:51
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.

3 participants