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

issubclass on two different subclasses of abstract base class like os.PathLike returns unexpected value on early versions of Py3.7 and Py3.8 #91211

Closed
mobiusklein mannequin opened this issue Mar 18, 2022 · 3 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@mobiusklein
Copy link
Mannequin

mobiusklein mannequin commented Mar 18, 2022

BPO 47055
Nosy @ericvsmith, @mobiusklein

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-03-20.23:20:36.269>
created_at = <Date 2022-03-18.02:52:35.204>
labels = ['3.7', '3.8', 'type-bug', 'library']
title = '`issubclass` on two different subclasses of abstract base class like `os.PathLike` returns unexpected value on early versions of Py3.7 and Py3.8'
updated_at = <Date 2022-03-20.23:20:36.267>
user = 'https://github.com/mobiusklein'

bugs.python.org fields:

activity = <Date 2022-03-20.23:20:36.267>
actor = 'mobiusklein'
assignee = 'none'
closed = True
closed_date = <Date 2022-03-20.23:20:36.269>
closer = 'mobiusklein'
components = ['Library (Lib)']
creation = <Date 2022-03-18.02:52:35.204>
creator = 'mobiusklein'
dependencies = []
files = []
hgrepos = []
issue_num = 47055
keywords = []
message_count = 3.0
messages = ['415467', '415494', '415642']
nosy_count = 2.0
nosy_names = ['eric.smith', 'mobiusklein']
pr_nums = []
priority = 'normal'
resolution = 'works for me'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue47055'
versions = ['Python 3.7', 'Python 3.8']

@mobiusklein
Copy link
Mannequin Author

mobiusklein mannequin commented Mar 18, 2022

The following code looks correct:

import os

class A(os.PathLike):
    pass

class B(os.PathLike):
    pass

assert issubclass(A, os.PathLike) # direct inheritance relationship
assert issubclass(B, os.PathLike) # direct inheritance relationship
assert not issubclass(A, B) # A is not derived from B or vice-versa

On Python 3.7.0-3.7.6 and 3.8.0-3.8.1 the third assertion fails. The expected behavior was restored in 3.7.7 and 3.8.2. This seems to be around when the internals of abc were translated to C.

Given that the behavior was fixed, but a bug fix matching this behavior wasn't listed in the changelog, the only resolution is to document that this behavior may be extant in older but still supported minor versions of Python. Where should that text be placed?

@mobiusklein mobiusklein mannequin added 3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 18, 2022
@ericvsmith
Copy link
Member

Since those releases are no longer supported, I don't think there's any place you could put this that would be seen. And we wouldn't want to put a note in a current release about a bug in a non-supported version that was fixed in another non-supported version.

@mobiusklein
Copy link
Mannequin Author

mobiusklein mannequin commented Mar 20, 2022

Understood. It's probably good practice to keep the interpreter version up to date in any case when debugging.

@mobiusklein mobiusklein mannequin closed this as completed Mar 20, 2022
@mobiusklein mobiusklein mannequin closed this as completed Mar 20, 2022
@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
3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant