-
Notifications
You must be signed in to change notification settings - Fork 48
Open
python/mypy
#19909Labels
bugpriority-0-highpython compatMypyc doesn't match CPython or documented semantics.Mypyc doesn't match CPython or documented semantics.
Description
using mypy 0.910
given
class DistFacade:
"""Emulate a pkg_resources Distribution"""
def __init__(self, dist: importlib_metadata.Distribution):
self._dist = dist
@property
def project_name(self) -> str:
return cast(str, self._dist.metadata["name"])
def __getattr__(
self, attr: str, default: Optional[object] = None
) -> Optional[object]:
return cast(Optional[object], getattr(self._dist, attr, default))
def __dir__(self) -> List[str]:
return sorted(dir(self._dist) + list(super().__dir__()))
i observe
(Pdb) dist
<pluggy._entrypoints.DistFacade object at 0x7f95925220d0>
(Pdb) dist.__getattr__
<built-in method __getattr__ of DistFacade object at 0x7f95925220d0>
(Pdb) dist.__getattr__("version")
'3.4.1'
(Pdb) getattr(dist, "version")
*** AttributeError: 'DistFacade' object has no attribute 'version'
(Pdb) dist.version
*** AttributeError: 'DistFacade' object has no attribute 'version'
Metadata
Metadata
Assignees
Labels
bugpriority-0-highpython compatMypyc doesn't match CPython or documented semantics.Mypyc doesn't match CPython or documented semantics.