classification
Title: PyImport_ReloadModule emits deprecation warning
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Robert Rouhani, brett.cannon, eric.snow, miss-islington, ncoghlan, python-dev
Priority: normal Keywords: patch

Created on 2020-04-28 06:40 by Robert Rouhani, last changed 2020-05-06 01:07 by Robert Rouhani. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19750 merged python-dev, 2020-04-28 07:24
PR 19934 merged Robert Rouhani, 2020-05-05 16:13
PR 19935 merged Robert Rouhani, 2020-05-05 16:33
Messages (10)
msg367501 - (view) Author: Robert Rouhani (Robert Rouhani) * Date: 2020-04-28 06:40
It appears as though PyImport_ReloadModule is importing the deprecated "imp" module.

I integrated a newer version of Python into Unreal Engine 4, which internally calls this function for some of it's own modules. Normally a stray warning wouldn't be of much concern to me, but the process of "cooking" (converting raw assets to optimized/final assets) will fail if anything is written to stderr. This makes it impossible to package a copy of the game for testing or release without a workaround.

I'm going to add a test to _testembed.c to verify my fix. Is this something that I should include in the Github PR?
msg367851 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2020-05-01 15:20
Yeah, that looks like an oversight.  I've approved your PR.  Thanks!
msg367853 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2020-05-01 15:22
Did you have a need for this to be fixed in 3.8 or earlier?  This seems reasonably and simple enough to backport.  I suppose someone could be relying on an implicit import of the "imp" module, but that seems highly unlikely and suspect anyway. :)
msg367863 - (view) Author: Robert Rouhani (Robert Rouhani) * Date: 2020-05-01 16:56
We have a fairly straightforward workaround of using the "warnings" module
to redirect to stdout, so we personally don't have a need.

Unreal, however, follows the VFX Reference Platform (
https://vfxplatform.com/) which is migrating from 2.7 to 3.7.x this year.
They will likely run into this during their migration, so backporting to
3.7 would be useful.

On Fri, May 1, 2020 at 8:22 AM Eric Snow <report@bugs.python.org> wrote:

>
> Eric Snow <ericsnowcurrently@gmail.com> added the comment:
>
> Did you have a need for this to be fixed in 3.8 or earlier?  This seems
> reasonably and simple enough to backport.  I suppose someone could be
> relying on an implicit import of the "imp" module, but that seems highly
> unlikely and suspect anyway. :)
>
> ----------
> nosy: +brett.cannon, ncoghlan
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue40417>
> _______________________________________
>
msg367899 - (view) Author: miss-islington (miss-islington) Date: 2020-05-01 23:28
New changeset f40bd466bf14029e2687e36e965875adf9d4be1a by Robert Rouhani in branch 'master':
bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750)
https://github.com/python/cpython/commit/f40bd466bf14029e2687e36e965875adf9d4be1a
msg368069 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-05-04 16:44
This can't be backported cleanly. If you're up for making PRs for 3.8 and 3.7, Robert, we can look at applying them.
msg368216 - (view) Author: miss-islington (miss-islington) Date: 2020-05-06 00:32
New changeset a32587a60da5939a3932bb30432d2bdd3d6203d4 by Robert Rouhani in branch '3.8':
[3.8] bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750) (GH-19934)
https://github.com/python/cpython/commit/a32587a60da5939a3932bb30432d2bdd3d6203d4
msg368217 - (view) Author: miss-islington (miss-islington) Date: 2020-05-06 00:49
New changeset d64fd617e02346ecbcba9559f227936e08e89602 by Robert Rouhani in branch '3.7':
[3.7] bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750) (GH-19935)
https://github.com/python/cpython/commit/d64fd617e02346ecbcba9559f227936e08e89602
msg368218 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-05-06 01:04
Thanks for all your hard work, Robert!
msg368219 - (view) Author: Robert Rouhani (Robert Rouhani) * Date: 2020-05-06 01:07
No problem! Happy to contribute where I can :)
History
Date User Action Args
2020-05-06 01:07:16Robert Rouhanisetmessages: + msg368219
2020-05-06 01:04:18brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg368218

stage: patch review -> resolved
2020-05-06 00:49:36miss-islingtonsetmessages: + msg368217
2020-05-06 00:32:21miss-islingtonsetmessages: + msg368216
2020-05-05 16:33:04Robert Rouhanisetpull_requests: + pull_request19250
2020-05-05 16:13:09Robert Rouhanisetpull_requests: + pull_request19249
2020-05-04 16:44:32brett.cannonsetversions: - Python 3.5, Python 3.6, Python 3.9
2020-05-04 16:44:14brett.cannonsetmessages: + msg368069
2020-05-01 23:28:13miss-islingtonsetnosy: + miss-islington
messages: + msg367899
2020-05-01 16:56:51Robert Rouhanisetmessages: + msg367863
2020-05-01 15:22:33eric.snowsetnosy: + brett.cannon, ncoghlan
messages: + msg367853
2020-05-01 15:20:26eric.snowsetnosy: + eric.snow
messages: + msg367851
2020-04-28 07:24:09python-devsetkeywords: + patch
nosy: + python-dev

pull_requests: + pull_request19071
stage: patch review
2020-04-28 06:40:55Robert Rouhanicreate