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

Avoid ResourceWarnings from platform._dist_try_harder #72090

Closed
scop mannequin opened this issue Aug 30, 2016 · 9 comments
Closed

Avoid ResourceWarnings from platform._dist_try_harder #72090

scop mannequin opened this issue Aug 30, 2016 · 9 comments
Labels
3.7 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@scop
Copy link
Mannequin

scop mannequin commented Aug 30, 2016

BPO 27903
Nosy @malemburg, @vstinner, @scop, @miss-islington, @tirkarthi
PRs
  • [3.7] bpo-27903: Fix ResourceWarning in platform.dist() #10792
  • [3.6] bpo-27903: Fix ResourceWarning in platform.dist() (GH-10792) #10793
  • Files
  • platform-resourcewarning.patch
  • 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 2018-11-29.12:04:41.868>
    created_at = <Date 2016-08-30.21:19:38.283>
    labels = ['3.7', 'type-feature', 'library']
    title = 'Avoid ResourceWarnings from platform._dist_try_harder'
    updated_at = <Date 2018-11-29.12:08:48.629>
    user = 'https://github.com/scop'

    bugs.python.org fields:

    activity = <Date 2018-11-29.12:08:48.629>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-11-29.12:04:41.868>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2016-08-30.21:19:38.283>
    creator = 'scop'
    dependencies = []
    files = ['44283']
    hgrepos = []
    issue_num = 27903
    keywords = ['patch']
    message_count = 9.0
    messages = ['273969', '326338', '330662', '330680', '330681', '330682', '330683', '330684', '330685']
    nosy_count = 5.0
    nosy_names = ['lemburg', 'vstinner', 'scop', 'miss-islington', 'xtreak']
    pr_nums = ['10792', '10793']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue27903'
    versions = ['Python 3.6', 'Python 3.7']

    @scop
    Copy link
    Mannequin Author

    scop mannequin commented Aug 30, 2016

    Use opened files as context managers.

    @scop scop mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Aug 30, 2016
    @tirkarthi
    Copy link
    Member

    Thanks for the report and patch Ville. CPython development now uses GitHub PR instead of patches. It seems usages of this function was removed in 8b94b41 during removal of platform.linux_distribution. This essentially seems to be unused code on master which I hope can be removed. So this patch is effective only for 3.7 and 3.6. Would you like to make a PR to take this forward?

    No usages on master except definition.

    ➜ cpython git:(master) rg _dist_try_harder
    Lib/platform.py
    230:def _dist_try_harder(distname, version, id):

    Thanks

    @tirkarthi
    Copy link
    Member

    I guess this can be closed as out of date since the function was removed with #10787.

    cc: Victor

    @vstinner
    Copy link
    Member

    Python 3.6 and 3.7 are still supported. The patch LGTM, I converted it to a PR.

    @vstinner vstinner added the 3.7 only security fixes label Nov 29, 2018
    @vstinner vstinner reopened this Nov 29, 2018
    @vstinner
    Copy link
    Member

    New changeset 7eeab87 by Victor Stinner in branch '3.7':
    bpo-27903: Fix ResourceWarning in platform.dist() (GH-10792)
    7eeab87

    @miss-islington
    Copy link
    Contributor

    New changeset cbf5767 by Miss Islington (bot) in branch '3.6':
    bpo-27903: Fix ResourceWarning in platform.dist() (GH-10792)
    cbf5767

    @vstinner
    Copy link
    Member

    Thanks Ville Skyttä for your bugfix! I applied it in 3.6 and 3.7 branches.

    FYI as Karthikeyan Singaravelan wrote, the function is gone (I removed it) from the master branch ;-)

    @tirkarthi
    Copy link
    Member

    Ah sorry I forgot the previous versions that had this code. Thanks for the catch and PR victor :)

    @vstinner
    Copy link
    Member

    No problem, thanks for "cc-ing" me ;-)

    @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 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants