[New-bugs-announce] [issue39081] pathlib '/' operator does not resolve Enums with str mixin as expected

Andrew Ni report at bugs.python.org
Tue Dec 17 18:37:20 EST 2019


New submission from Andrew Ni <niandrew7 at gmail.com>:

import os
import pathlib
import enum

class MyEnum(str, enum.Enum):
    RED = 'red'

# this resolves to: '/Users/niandrew/MyEnum.RED'
# EXPECTED: '/Users/niandrew/red'
str(pathlib.Path.home() / MyEnum.RED)

# this resolves to: '/Users/niandrew/red'
os.path.join(pathlib.Path.home(), MyEnum.RED)

----------
components: Library (Lib)
messages: 358598
nosy: andrewni
priority: normal
severity: normal
status: open
title: pathlib '/' operator does not resolve Enums with str mixin as expected
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39081>
_______________________________________


More information about the New-bugs-announce mailing list