Closed
Description
sysconfig imports pprint in order to print the config dict to a file. But this dict contains only strings and ints, so pprint is overkill.
The problem with importing pprint is that it imports dataclasses, which imports inspect, which imports dis which imports opcode which tries to import _opcode which does not exist in early stages of the build when sysconfig is used. So opcode imports _opcode in a try-except and ignores import errors. Since sysconfig doesn't need anything from _opcode, the partially constructed opcode module suffices. But this is flaky and hard to reason about (it works because it works). It would be better if sysconfig didn't import so much.