Skip to content

Custom frozen modules get ignored. #89559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ericsnowcurrently opened this issue Oct 6, 2021 · 8 comments
Closed

Custom frozen modules get ignored. #89559

ericsnowcurrently opened this issue Oct 6, 2021 · 8 comments
Assignees
Labels
3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@ericsnowcurrently
Copy link
Member

BPO 45396
Nosy @gvanrossum, @brettcannon, @ericsnowcurrently
PRs
  • bpo-45396: Always import custom frozen modules. #28776
  • bpo-45395: Make custom frozen modules additions instead of replacements. #28778
  • gh-89559: Change -X frozen_modules to -X frozen_stdlib. #29301
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ericsnowcurrently'
    closed_at = None
    created_at = <Date 2021-10-06.20:22:14.892>
    labels = ['interpreter-core', 'type-bug', '3.11']
    title = 'Custom frozen modules get ignored.'
    updated_at = <Date 2021-10-28.21:34:52.384>
    user = 'https://github.com/ericsnowcurrently'

    bugs.python.org fields:

    activity = <Date 2021-10-28.21:34:52.384>
    actor = 'eric.snow'
    assignee = 'eric.snow'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2021-10-06.20:22:14.892>
    creator = 'eric.snow'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45396
    keywords = ['patch']
    message_count = 4.0
    messages = ['403336', '403337', '403705', '405277']
    nosy_count = 3.0
    nosy_names = ['gvanrossum', 'brett.cannon', 'eric.snow']
    pr_nums = ['28776', '28778', '29301']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue45396'
    versions = ['Python 3.11']

    @ericsnowcurrently
    Copy link
    Member Author

    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.)

    @ericsnowcurrently ericsnowcurrently added the 3.11 only security fixes label Oct 6, 2021
    @ericsnowcurrently ericsnowcurrently self-assigned this Oct 6, 2021
    @ericsnowcurrently ericsnowcurrently added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error 3.11 only security fixes labels Oct 6, 2021
    @ericsnowcurrently ericsnowcurrently self-assigned this Oct 6, 2021
    @ericsnowcurrently ericsnowcurrently added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Oct 6, 2021
    @ericsnowcurrently
    Copy link
    Member Author

    (This was motivated by #28633 (comment).)

    @gvanrossum
    Copy link
    Member

    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.

    @ericsnowcurrently
    Copy link
    Member Author

    The behavior has been addressed in the fix for bpo-45395. However, I'd like to change the name of the -X option from "frozen_modules" to "frozen_stdlib", to avoid any confusion in the future. After that this issue is done.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @kumaraditya303
    Copy link
    Contributor

    However, I'd like to change the name of the -X option from "frozen_modules" to "frozen_stdlib", to avoid any confusion in the future.

    Do we still want to pursue this? I don't think we should change the name as it is been this way for the past beta and alphas.

    @gvanrossum
    Copy link
    Member

    However, I'd like to change the name of the -X option from "frozen_modules" to "frozen_stdlib", to avoid any confusion in the future.

    Do we still want to pursue this? I don't think we should change the name as it is been this way for the past beta and alphas.

    Agreed, let's not change this. Closing as "fixed" because everything else is taken care of.

    @erlend-aasland
    Copy link
    Contributor

    I assume this implies also closing the linked open PR. I'm marking it as pending close.

    @gvanrossum
    Copy link
    Member

    Yes please.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants