[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: -Python 3.6 ___ Python tracker ___ __

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: New changeset 59d06b987db34cde8783e265709366d244c9e35b by Ivan Levkivskyi (Bar Harel) in branch '3.7': [3.7] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17685) https://github.com/python/cpython/commit/59d06b987db34cde8783e265709366d244c9e35b

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: New changeset 0846e5d4603434c2bbf8a528677cf1ff3fe29b95 by Ivan Levkivskyi (Bar Harel) in branch '3.8': [3.8] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17684) https://github.com/python/cpython/commit/0846e5d4603434c2bbf8a528677cf1ff3fe29b95

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Bar Harel
Change by Bar Harel : -- pull_requests: +17142 pull_request: https://github.com/python/cpython/pull/17685 ___ Python tracker ___ ___

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-23 Thread Bar Harel
Change by Bar Harel : -- pull_requests: +17141 pull_request: https://github.com/python/cpython/pull/17684 ___ Python tracker ___ ___

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-22 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: New changeset eae87e3e4e0cb9a0ce10c2e101acb6995d79e09c by Ivan Levkivskyi (Bar Harel) in branch 'master': bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) https://github.com/python/cpython/commit/eae87e3e4e0cb9a0ce10c2e101acb6995d79e09c -- _

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-04 Thread Brett Cannon
Change by Brett Cannon : -- nosy: -brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-12-03 Thread Bar Harel
Bar Harel added the comment: Ready for merge -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-23 Thread Bar Harel
Bar Harel added the comment: A better example is this: class A(PathLike): def foo(self): """For all your foo needs""" class B: def __fspath__(self): pass issubclass(B, A) == True A().foo() # Yay, I Foo'd. B().foo() # oh barnacles, I

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-22 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-22 Thread Ammar Askar
Ammar Askar added the comment: Just for reference/existing behavior: >>> class A(collections.abc.Iterable): pass ... >>> class B: ... def __iter__(): pass ... >>> issubclass(B, A) False >>> issubclass(B, collections.abc.Iterable) True >>> issubclass(A, collections.abc.Iterable) True ---

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-22 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: > So why is it bad that in the example class B is considered a "subclass" of > os.PathLike by implementing the protocol? This is not bad, my understanding of the problem is that currently B is considered a subclass of A, while the latter should not be struc

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-22 Thread Brett Cannon
Brett Cannon added the comment: I just realized one problem with this is it explicitly requires subclassing the ABC while os.PathLike is supposed to represent a protocol (before typing.Protocol was a thing). So why is it bad that in the example class B is considered a "subclass" of os.PathL

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-22 Thread Bar Harel
Bar Harel added the comment: Done. On Fri, Nov 22, 2019, 12:23 PM Bar Harel wrote: > > Change by Bar Harel : > > > -- > keywords: +patch > pull_requests: +16820 > stage: resolved -> patch review > pull_request: https://github.com/python/cpython/pull/17336 > >

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-22 Thread Bar Harel
Change by Bar Harel : -- keywords: +patch pull_requests: +16820 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/17336 ___ Python tracker __

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-21 Thread Brett Cannon
Brett Cannon added the comment: Ah, your `assert` call threw me since it does succeed so it isn't acting as a test case. -- resolution: not a bug -> status: closed -> open ___ Python tracker __

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-21 Thread Bar Harel
Bar Harel added the comment: Hey Brett, that's exactly the bug. It's supposed to be False ofc. On Thu, Nov 21, 2019, 9:45 PM Brett Cannon wrote: > > Brett Cannon added the comment: > > I can't reproduce in Python 3.8.0: > > >>> import os > >>> class A(os.PathLike): pass > ... > >>> class B:

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-21 Thread Brett Cannon
Brett Cannon added the comment: I can't reproduce in Python 3.8.0: >>> import os >>> class A(os.PathLike): pass ... >>> class B: ... def __fspath__(self): pass ... >>> issubclass(B, A) True Did you check against an older version of Python? -- resolution: -> not a bug stage: ->

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-21 Thread Batuhan
Change by Batuhan : -- nosy: +brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

2019-11-21 Thread Bar Harel
New submission from Bar Harel : Quick and small fix. os.PathLike.__subclasshook__ does not check if cls is PathLike as abstract classes should. This in turn causes this bug: class A(PathLike): pass class B: def __fspath__(self): pass assert issubclas