Skip to content
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

sys.flags and sys.float_info disappear at shutdown #64801

Closed
pitrou opened this issue Feb 11, 2014 · 10 comments
Closed

sys.flags and sys.float_info disappear at shutdown #64801

pitrou opened this issue Feb 11, 2014 · 10 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Feb 11, 2014

BPO 20602
Nosy @pitrou, @vstinner, @tiran, @encukou, @serhiy-storchaka, @ZackerySpytz
PRs
  • bpo-20602: Do not clear sys.flags and sys.float_info during shutdown #8096
  • Files
  • sys_at_exit.py
  • 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 = None
    closed_at = <Date 2019-06-02.21:31:33.722>
    created_at = <Date 2014-02-11.19:22:01.349>
    labels = ['interpreter-core', '3.8', 'type-bug', '3.7']
    title = 'sys.flags and sys.float_info disappear at shutdown'
    updated_at = <Date 2019-06-02.21:31:33.721>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2019-06-02.21:31:33.721>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-02.21:31:33.722>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2014-02-11.19:22:01.349>
    creator = 'pitrou'
    dependencies = []
    files = ['38404']
    hgrepos = []
    issue_num = 20602
    keywords = ['patch']
    message_count = 10.0
    messages = ['211001', '237604', '237617', '237620', '237621', '237622', '321071', '331426', '343970', '344323']
    nosy_count = 6.0
    nosy_names = ['pitrou', 'vstinner', 'christian.heimes', 'petr.viktorin', 'serhiy.storchaka', 'ZackerySpytz']
    pr_nums = ['8096']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue20602'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @pitrou
    Copy link
    Member Author

    pitrou commented Feb 11, 2014

    For some reason they are wiped to fix so-called reference leaks:
    http://hg.python.org/cpython/rev/9639a73afa47/

    This changeset is one of the culprits of the problems in bpo-19255.

    @pitrou pitrou added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Feb 11, 2014
    @vstinner
    Copy link
    Member

    vstinner commented Mar 9, 2015

    I don't understand this bug report. Can you elaborate? What is the current behaviour? What is the expected behaviour?

    @pitrou
    Copy link
    Member Author

    pitrou commented Mar 9, 2015

    The behaviour is explained in the subject line and in the linked changeset: for some reason sys.flags and sys.float_info are explicitly wiped during shutdown. But those are simple immutable objects, there is no reason to wipe them.

    The expected behaviour is, of course, that those objects keep their proper value during shutdown (e.g. when looked up from destructors).

    @vstinner
    Copy link
    Member

    vstinner commented Mar 9, 2015

    sys_at_exit.py: script to reproduce the issue.

    The changeset 9639a73afa47 explicitly added sys.flags and sys.float_info to sys_deletes, list of symbols that must be cleared at exit.

    So if I understand correctly the issue, the question is why the change was made. Antoine wants to keep these symbols alive during Python shutdown.

    @vstinner
    Copy link
    Member

    vstinner commented Mar 9, 2015

    @antoine: Can you maybe propose a patch to fix this issue?

    I see that you selected Python 3.4 & 3.5. Why Python 3.4 and not 2.7? (Maybe fixing Python 3.5 is enough?)

    @pitrou
    Copy link
    Member Author

    pitrou commented Mar 9, 2015

    I really don't care about 2.7 for minor fixes is the reason why :-)
    (also, I don't know if the bug exists there in the first place)

    @ZackerySpytz
    Copy link
    Mannequin

    ZackerySpytz mannequin commented Jul 5, 2018

    This behaviour is present in 2.7.

    @ZackerySpytz ZackerySpytz mannequin added 3.7 (EOL) end of life 3.8 only security fixes labels Jul 5, 2018
    @ZackerySpytz
    Copy link
    Mannequin

    ZackerySpytz mannequin commented Dec 9, 2018

    Ping.

    @encukou
    Copy link
    Member

    encukou commented May 30, 2019

    New changeset 249b7d5 by Petr Viktorin (Zackery Spytz) in branch 'master':
    bpo-20602: Do not clear sys.flags and sys.float_info during shutdown (GH-8096)
    249b7d5

    @vstinner
    Copy link
    Member

    vstinner commented Jun 2, 2019

    Honestly, I'm not sure that this issue is really a major bug. I don't think that it's worth it to backport the change. It's more a subtle change in Python finalization which is super fragile code. I prefer to only change the master branch, so I close the issue.

    @vstinner vstinner closed this as completed Jun 2, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 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

    3 participants