Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

IDLE: unwanted submodule imports in 'run' #103423

Open
Assignees
terryjreedy
Labels
3.12only security fixestopic-IDLEtype-bugAn unexpected behavior, bug, or error
@terryjreedy

Description

@terryjreedy

In all of 3.10.11+, 3.11.3+, and 3.12.0a7+ (locally compiled) in a newly started REPLimport importlib; importlib.util fails with AttributeError. In a freshly started IDLE Shell, the same statement succeeds. This is because IDLE imports importlib.util and leaves the name 'util' in importlib when starting the usercode execution subprocess. I consider this a bug as it makes user code run during development in IDLE even though it will fail when run directly, without IDLE. This is a similar issue to#69693 for tkinter.font.

I checked other things withfor name in sorted(sys.modules.keys()): print(name)

Submodules present on python startup should remain present after IDLE run startup
importlib.machinery is perhaps a bug. Any fix will carry over to IDLE.
encodings.codecs are like intentional.

idlelib itself has one attribute,testing. Document if not already.
import idlelib in idlelib gives access to many submodules. Doc that subject to change, don't depend on it. Instead import idlelib.module.

Following should not be touched:
import collections imports abc. Believe intentional.
import tkinter imports constants. Intentional?
import typing imports io, re. Intentional?
import re imports few ._xxxs

Following are either from other non-IDLE stdlib modules that IDLE imports or from other IDLE modules. At least fix latter.
import urllib does not import parse
import xml imports nothing else.

Issue inspired byimportlib discussion. David Ellis said that importlib.machinery in REPL is from rlcompleter. (True on Windows?) and that importlib.util may be from sphinx or site. For IDLE run, it should not matter if run from editor.

Metadata

Metadata

Assignees

Labels

3.12only security fixestopic-IDLEtype-bugAn unexpected behavior, bug, or error

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp