Skip to content

Conversation

@TheAhumMaitra
Copy link

This PR refactors the IDLE launcher script (IDLE.py) to improve clarity and maintainability.

Changes include:

  • Simplified the way idlelib is added to sys.path for non-standard locations.
  • Added comments explaining the purpose of each step.
  • Ensured safer insertion into sys.path without overwriting existing paths.
  • Made the script easier to read and understand for contributors and beginners.

This helps prevent errors when running IDLE from development versions of Python and makes the codebase more maintainable.

@bedevere-app
Copy link

bedevere-app bot commented Aug 24, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@picnixz
Copy link
Member

picnixz commented Aug 24, 2025

  • This doesn't improve safety in any way.
  • It's a purely cosmetic change. There is only one change that we could accept, that is putting main() inside an if __name__ == '__main__' guard but I'm not sure about its intended behavior (doing this would prevent loading IDLE by simply importing it, so it's a behavioral change). This should be discussed in an issue if needed but I don't think we need to.

@picnixz picnixz closed this Aug 24, 2025
@terryjreedy
Copy link
Member

I agree with closure. With changes to 3 unrelated files, I wonder if this is llm spam.

I am not sure if the path insertion is needed and have considered removing it. It may be duplicated elsewhere. In the absence of a valid problem report, I will not touch it until I review all of the path manipulations in idlelib.

I routinely start IDLE from a freshly built Python REPL with import idlelib.idle, so the main change is WRONG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants