[New-bugs-announce] [issue18070] change importlib.util.module_for_loader to unconditionally set attributes

Brett Cannon report at bugs.python.org
Mon May 27 15:59:43 CEST 2013

New submission from Brett Cannon:

importlib.util.module_for_loader (as well as set_package and set_loader) only set those attributes either when they are not already set or when the module is new. I realized this is a problem as it means a reload won't work the way one might expect.

I want to at least change module_for_loader since I suspect that is in wider use, but probably all three decorators to unconditionally set their respective attributes so reloads operate as expected. Unfortunately that is backwards-incompatible, albeit for probably a rare case if anyone actually cares.

Anyone see a reason why doing this is a bad idea and it shouldn't be done?

components: Library (Lib)
messages: 190139
nosy: barry, brett.cannon, eric.smith, eric.snow, ncoghlan
priority: normal
severity: normal
stage: test needed
status: open
title: change importlib.util.module_for_loader to unconditionally set attributes
type: behavior
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list