The patch is guarded by sys.implementation.name == "pypy".
- On PyPy with supported Pylint and Astroid versions, the shim replaces
astroid.raw_building.InspectBuilder.object_build. - On CPython, the shim logs a debug message and returns without changing Astroid.
- On unsupported versions, the shim logs a warning and returns without changing Astroid unless strict mode is enabled.
The patched object builder:
- ignores non-string entries returned by
dir(obj); - treats
AttributeErrorandTypeErrorfromgetattr(obj, alias)as a skipped member and lets Astroid attach a dummy node; - preserves PyPy's special
__class_getitem__route through Astroid's builtin member builder; - otherwise delegates to Astroid's existing class, descriptor, constant, routine, module-like, and dummy builders.