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

Incosistency in pathlib between / and \ #67335

Closed
serhiy-storchaka opened this issue Jan 2, 2015 · 6 comments
Closed

Incosistency in pathlib between / and \ #67335

serhiy-storchaka opened this issue Jan 2, 2015 · 6 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 23146
Nosy @pitrou, @serhiy-storchaka
Files
  • pathlib_parse_parts_altsep.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 = 'https://github.com/pitrou'
    closed_at = <Date 2015-02-15.17:07:32.836>
    created_at = <Date 2015-01-02.09:40:25.124>
    labels = ['type-bug', 'library']
    title = 'Incosistency in pathlib between / and \\'
    updated_at = <Date 2015-02-15.17:07:32.835>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2015-02-15.17:07:32.835>
    actor = 'pitrou'
    assignee = 'pitrou'
    closed = True
    closed_date = <Date 2015-02-15.17:07:32.836>
    closer = 'pitrou'
    components = ['Library (Lib)']
    creation = <Date 2015-01-02.09:40:25.124>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['38117']
    hgrepos = []
    issue_num = 23146
    keywords = ['patch']
    message_count = 6.0
    messages = ['233308', '235826', '235851', '235855', '236048', '236049']
    nosy_count = 3.0
    nosy_names = ['pitrou', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue23146'
    versions = ['Python 3.4', 'Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    >>> pathlib.PureWindowsPath('c:/a/b', '/x/y')
    PureWindowsPath('c:/x/y')
    >>> pathlib.PureWindowsPath('//?/c:/a/b', '/x/y')
    PureWindowsPath('/x/y')
    >>> pathlib.PureWindowsPath(r'\\?\c:\a\b', '/x/y')
    PureWindowsPath('//?/c:/x/y')

    I suppose this is because in parse_parts() altsep is replaced with sep before calling self.splitroot() in main loop but not in other loop (if drv or root). Line 76.

    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jan 2, 2015
    @serhiy-storchaka
    Copy link
    Member Author

    Ping.

    @pitrou
    Copy link
    Member

    pitrou commented Feb 12, 2015

    Yes, this is a bug indeed. A patch would be welcome ;-)

    @serhiy-storchaka
    Copy link
    Member Author

    Here is a patch. It also fixes tests which didn't test altsep.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 15, 2015

    New changeset 0f8f24dab34b by Antoine Pitrou in branch '3.4':
    Issue bpo-23146: Fix mishandling of absolute Windows paths with forward slashes in pathlib.
    https://hg.python.org/cpython/rev/0f8f24dab34b

    New changeset 0de45993c21c by Antoine Pitrou in branch 'default':
    Issue bpo-23146: Fix mishandling of absolute Windows paths with forward slashes in pathlib.
    https://hg.python.org/cpython/rev/0de45993c21c

    @pitrou
    Copy link
    Member

    pitrou commented Feb 15, 2015

    Thanks for the patch!

    @pitrou pitrou closed this as completed Feb 15, 2015
    @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
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants