Title: Custom frozen modules get ignored.
Type: behavior Stage: patch review
Components: Interpreter Core Versions: Python 3.11
Status: open Resolution:
Dependencies: Superseder:
Assigned To: eric.snow Nosy List: brett.cannon, eric.snow, gvanrossum
Priority: normal Keywords: patch

Created on 2021-10-06 20:22 by eric.snow, last changed 2021-10-12 00:01 by gvanrossum.

Pull Requests
URL Status Linked Edit
PR 28776 closed eric.snow, 2021-10-06 20:34
Messages (3)
msg403336 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2021-10-06 20:22
Recently we added the "-X frozen_modules" CLI option to control whether or not (non-essential) frozen modules get used.  Currently the default is "off", though the plan is to make the default "on".  Regardless, this is problematic for executables with custom frozen modules (where PyImport_FrozenModules is overridden).  If there are custom frozen modules then they should always be used.

Note that there are already other problems with custom frozen modules, to be addressed separately.  (See bpo-45395.)
msg403337 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2021-10-06 20:24
(This was motivated by
msg403705 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-10-12 00:01
I'm not convinced by the comment you linked to.

It seems Brett is referring to the case where at the C level someone overrides `PyImport_FrozenModules` (a global in frozen.c) -- though it is never explicitly named in the thread. And that variable *is* ignored when the -X flag is set to off (at least, it is ignored when use_frozen() is false and we're not talking about an "essensial" frozen module; and I think use_frozen() corresponds to whether the -X flag is on or off, or its default). So I think the -X flag is named correctly.
Date User Action Args
2021-10-12 00:01:17gvanrossumsetnosy: + gvanrossum
messages: + msg403705
2021-10-06 20:34:59eric.snowsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request27110
2021-10-06 20:24:43eric.snowsetmessages: + msg403337
2021-10-06 20:22:14eric.snowcreate