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
Fix idlelib.PyShell.build_subprocess_arglist use of __import__ #62530
Comments
The purpose of the function is to create a command line for the user subprocess. Most of its body: The first command looks 'funny' because of the repetition of 'run'. The reason is that __import__('idlelib.run') returns idlelib, not idlelib.run. Perhaps it would work to delete .run in the import, or to use importlib.import_module. The second command incorrectly assumes that if __name__ == '__main__' (the alternative to 'idlelib.PyShell'), then the directory containing PyShell and run is the current working directory. This is true if PyShell is run from that directory, but F:\Python\dev\py33\PCbuild>python_d -m idlelib.PyShell both report "ImportError: No module named 'run'" and open a shell window and error message box a few seconds later. The shell closes when the messagebox is dismissed. It seems to me that the 'else' caters to a non-existent or impossible use case. PyShell has several 'from idlelib.X import Y' statements. If those work, then "from idlelib import run' must work, and so too must the function equivalent. |
@terry just a reminder for yourself and your band of merry men and women. |
The problem with touching this stuff is that there is not only not an automatec test, there is not even a script for a manual test. |
Since filing this, I have decided that starting Idle directly with PyShell should be deprecated. That would affect any patch for this. In the meanwhile, there are other priorities. |
In bpo-36429, the 'else' branch that did not work was deleted. The reason __import__ is discouraged is the reason for the repetition of 'run', in the line kept, as explained above. However, since the line works, it is not a bug, and I now prefer to leave it alone. If someone disables it, IDLE will not start. del_exitf was added for Visual IDLE -- VIDLE (sp?) Investigating whether it is still needed and possible deleting it is another issue. So is deprecating starting with PyShell, or having pyshell as main running tests in a development setting. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: