Skip to content

tarfile.open: improper handling of path-like object #81325

Closed

Description

@DarkaMaul
mannequin
BPO 37144
Nosy @terryjreedy, @gustaebel, @serhiy-storchaka, @tirkarthi, @DarkaMaul, @zygocephalus
PRs
  • bpo-37144: Convert path-like object to regular path #13817
  • Files
  • poc.py: Proof Of Concept
  • 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 = None
    created_at = <Date 2019-06-03.14:54:20.472>
    labels = ['3.7', '3.8', 'type-bug', 'library', '3.9']
    title = 'tarfile.open: improper handling of path-like object'
    updated_at = <Date 2019-06-07.19:59:04.122>
    user = 'https://github.com/DarkaMaul'

    bugs.python.org fields:

    activity = <Date 2019-06-07.19:59:04.122>
    actor = 'terry.reedy'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2019-06-03.14:54:20.472>
    creator = 'dm'
    dependencies = []
    files = ['48386']
    hgrepos = []
    issue_num = 37144
    keywords = ['patch']
    message_count = 3.0
    messages = ['344423', '344616', '345005']
    nosy_count = 6.0
    nosy_names = ['terry.reedy', 'lars.gustaebel', 'serhiy.storchaka', 'xtreak', 'dm', 'zygocephalus']
    pr_nums = ['13817']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue37144'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    Linked PRs

    Activity

    1. DarkaMaul commented on Jun 3, 2019

      DarkaMaulmannequin
      MannequinAuthor

      According to the documentation, tarfile.open accepts a path-like object since Python 3.6

      However, it is not the case when writing a compressed gzip (w|gz).
      See the attached file for minimal POC

      Note 1: tested on 3.6 and 3.7
      Note 2: https://docs.python.org/3.6/library/tarfile.html#tarfile.open

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Jun 3, 2019
    3. tirkarthi commented on Jun 4, 2019

      @tirkarthi
      Member

      This was documented in c45cd16 but it seems a test for opening gzip file with 'w|gz' mode as in the original report was missing.

    4. terryjreedy commented on Jun 7, 2019

      @terryjreedy
      Member

      3.6 only gets security patches. Thanks for testing with 3.7 also.

    5. transferred this issue fromon Apr 10, 2022
    6. added a commit that references this issue on Jul 28, 2025
    7. added a commit that references this issue on Aug 4, 2025
    8. added 2 commits that reference this issue on Aug 4, 2025
    9. added a commit that references this issue on Aug 5, 2025
    10. added a commit that references this issue on Aug 19, 2025
    11. added a commit that references this issue on Oct 7, 2025
    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

      stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions