This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.snow
Recipients brett.cannon, christoph.wiedemann, cschramm, eric.snow, ncoghlan, petr.viktorin, scoder
Date 2018-08-02.15:56:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533225379.33.0.56676864532.issue34309@psf.upfronthosting.co.za>
In-reply-to
Content
I've changed the issue title to reflect where things stand.

Hmm, doing so reminded me of an important consideration here.  A module object is effectively a fairly light wrapper around a dict.  When you call importlib.reload() the loader from the module's spec is used to re-execute the module's existing dict. [1][2]  A new module is not created and the existing module namespace is not reset.  So during reload the module is responsible for deleting anything in its namespace that wouldn't get replaced when re-executed (including attributes that were added to the namespace externally).  For most modules this isn't an issue.  However, it's something to consider when reloading a module.  See the docs for more explanation and caveats. [3]

[1] https://github.com/python/cpython/blob/master/Lib/importlib/__init__.py#L169
[2] https://github.com/python/cpython/blob/master/Lib/importlib/_bootstrap.py#L610
[3] https://docs.python.org/3/library/importlib.html#importlib.reload
History
Date User Action Args
2018-08-02 15:56:19eric.snowsetrecipients: + eric.snow, brett.cannon, ncoghlan, scoder, petr.viktorin, cschramm, christoph.wiedemann
2018-08-02 15:56:19eric.snowsetmessageid: <1533225379.33.0.56676864532.issue34309@psf.upfronthosting.co.za>
2018-08-02 15:56:19eric.snowlinkissue34309 messages
2018-08-02 15:56:19eric.snowcreate