GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pathlib.Path.__enter__() should emit DeprecationWarning · Issue #90714 · python/cpython

pathlib.Path.__enter__() should emit DeprecationWarning #90714

New issue
Copy link
New issue
Copy link
Closed
Closed
pathlib.Path.__enter__() should emit DeprecationWarning#90714
Copy link
Labels
3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-pathlibtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

barneygale
mannequin
opened on Jan 27, 2022
Issue body actions
BPO 46556
Nosy @brettcannon, @barneygale
PRs
  • bpo-46556: emit DeprecationWarning from pathlib.Path.__enter__() #30971
  • 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 2022-02-08.21:02:04.592>
    created_at = <Date 2022-01-27.23:07:21.767>
    labels = ['type-bug', 'library', '3.11']
    title = 'pathlib.Path.__enter__() should emit DeprecationWarning'
    updated_at = <Date 2022-02-08.21:02:04.592>
    user = 'https://github.com/barneygale'

    bugs.python.org fields:

    activity = <Date 2022-02-08.21:02:04.592>
    actor = 'brett.cannon'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-02-08.21:02:04.592>
    closer = 'brett.cannon'
    components = ['Library (Lib)']
    creation = <Date 2022-01-27.23:07:21.767>
    creator = 'barneygale'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46556
    keywords = ['patch']
    message_count = 2.0
    messages = ['411936', '412870']
    nosy_count = 2.0
    nosy_names = ['brett.cannon', 'barneygale']
    pr_nums = ['30971']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue46556'
    versions = ['Python 3.11']

    Activity

    1. barneygale commented on Jan 27, 2022

      @barneygale
      barneygalemannequin
      on Jan 27, 2022
      MannequinAuthor
      More actions

      In Python 3.9 / bpo-39682 we made Path.__exit__() a no-op, and added a comment in the code mentioning that it should be deprecated in future. The future is here, so let's deprecate it.

    2. barneygale
      added
      3.11only security fixesonly security fixes
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Jan 27, 2022
    3. brettcannon commented on Feb 8, 2022

      @brettcannon
      brettcannon
      on Feb 8, 2022
      Member
      More actions

      New changeset 06e1701 by Barney Gale in branch 'main':
      bpo-46556: emit DeprecationWarning from pathlib.Path.__enter__() (GH-30971)
      06e1701

    4. brettcannon
      closed this as completedon Feb 8, 2022
    5. brettcannon
      closed this as completedon Feb 8, 2022
    6. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    7. skshetry
      added 2 commits that reference this issue on Oct 15, 2022

      remove pathlib.Path use as a contextmanager

      3f0b2a9

      remove pathlib.Path use as a contextmanager

      d4450c7
    8. pixelb
      added a commit that references this issue on Oct 17, 2022

      remove pathlib.Path use as a contextmanager

      5300a86
    9. dss010101 commented on Oct 3, 2023

      @dss010101
      dss010101
      on Oct 3, 2023
      More actions

      so how do we use Path to avoid this warning?

    10. dss010101 commented on Nov 29, 2023

      @dss010101
      dss010101
      on Nov 29, 2023
      More actions

      anyone..anyone...

    11. AlexWaygood
      added
      topic-pathlib
      on Nov 29, 2023
    12. barneygale commented on Nov 29, 2023

      @barneygale
      barneygale
      on Nov 29, 2023
      ContributorAuthor
      More actions

      so how do we use Path to avoid this warning?

      Don't use a path object as a context manager, e.g. rather than:

      with Path('foo') as path:
          ...

      use:

      path = Path('foo')
    13. dss010101 commented on Nov 30, 2023

      @dss010101
      dss010101
      on Nov 30, 2023
      More actions

      so how do we use Path to avoid this warning?

      Don't use a path object as a context manager, e.g. rather than:

      with Path('foo') as path:
          ...

      use:

      path = Path('foo')

      Ah got it. that is what i had ended up doing - wasn't sure if there still was a way to use it with the 'with' block.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-pathlibtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.