[New-bugs-announce] [issue27403] os.path.dirname doesn't handle Windows' URNs correctly

Dustin Oprea report at bugs.python.org
Mon Jun 27 17:03:41 EDT 2016

New submission from Dustin Oprea:

Notice that os.path.dirname() returns whatever it is given if it is given a URN, regardless of slash-type. Oddly, you have to double-up the forward-slashes (like you're escaping them) in order to get the correct result (if you're using forward-slashes). Back-slashes appear to be broken no matter what.

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> os.path.dirname("\\\\a\\b")
>>> os.path.dirname("//a/b")
>>> os.path.dirname("////a//b")

Any ideas?

components: Windows
messages: 269404
nosy: Dustin.Oprea, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.path.dirname doesn't handle Windows' URNs correctly
type: behavior
versions: Python 2.7, Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list