Skip to content

Astroid crashes on PyPy 3.11: TypeError expected str, got getset_descriptor object #11092

@jerome-jjc

Description

@jerome-jjc

Bug description

#  pylint fails with PyPy using either astroid 4.0.4 or astroid 4.2.0b3
#  pylint is OK with python 3.14 and both  astroid 4.0.4 or astroid 4.2.0b3

Configuration

(.venv4) PS C:/Users/jerom/PycharmProjects/proj3> python --version
    Python 3.11.15 (dc0121776214, Apr 28 2026, 06:06:46)
    [PyPy 7.3.22 with MSC v.1941 64 bit (AMD64)]

(.venv4) PS C:/Users/jerom/PycharmProjects/proj3> pylint --version
    pylint 4.0.5
    astroid 4.2.0b3
    Python 3.11.15 (dc0121776214, Apr 28 2026, 06:06:46)
    [PyPy 7.3.22 with MSC v.1941 64 bit (AMD64)]

Command used

pylint trivial_code.py

Bug description

When parsing the following a.py:

"""  pylint trivial_code.py
  fails with PyPy, not CPython.
  OK in 3.14

(.venv4) PS C:/Users/jerom/PycharmProjects\proj3> python --version
    Python 3.11.15 (dc0121776214, Apr 28 2026, 06:06:46)
    [PyPy 7.3.22 with MSC v.1941 64 bit (AMD64)]

(.venv4) PS C:/Users/jerom/PycharmProjects\proj3> pylint --version
    pylint 4.0.5
    astroid 4.2.0b3
    Python 3.11.15 (dc0121776214, Apr 28 2026, 06:06:46)
    [PyPy 7.3.22 with MSC v.1941 64 bit (AMD64)]
"""
import sys
if __name__ == '__main__':
    print( f"#V1 {sys.version=:}")  # V1 sys.version=3.11.15 (dc0121776214, Apr 28 2026, 06:06:46)  [PyPy 7.3.22 with MSC v.1941 64 bit (AMD64)]

Command used

pylint a.py

Pylint output

Traceback (most recent call last):
  File "C:\Users\jerom\PycharmProjects\proj3\.venv4\Lib\site-packages\pylint\lint\pylinter.py", line 1012, in get_ast
    return MANAGER.ast_from_file(filepath, modname, source=True)
                   ^^^^^^^^^^^^^
  File "C:\Users\jerom\PycharmProjects\proj3\.venv4\Lib\site-packages\astroid\manager.py", line 165, in ast_from_file
    return AstroidBuilder(self).file_build(filepath, modname)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jerom\PycharmProjects\proj3\.venv4\Lib\site-packages\astroid\builder.py", line 82, in __init__
    manager.bootstrap()
            ^^^^^^^^^
  File "C:\Users\jerom\PycharmProjects\proj3\.venv4\Lib\site-packages\astroid\manager.py", line 432, in bootstrap
    raw_building._astroid_bootstrapping()
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jerom\PycharmProjects\proj3\.venv4\Lib\site-packages\astroid\raw_building.py", line 733, in _astroid_bootstrapping
    builder.object_build(klass, _type)
            ^^^^^^^^^^^^
  File "C:\Users\jerom\PycharmProjects\proj3\.venv4\Lib\site-packages\astroid\raw_building.py", line 486, in object_build
    member = getattr(obj, alias)
             ^^^^^^^^^^^^^^^^^^^
TypeError: expected str, got getset_descriptor object

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\jerom\PycharmProjects\proj3\.venv4\Lib\site-packages\pylint\lint\pylinter.py", line 745, in _get_asts
    ast_per_fileitem[fileitem] = self.get_ast(
                                      ^^^^^^^
  File "C:\Users\jerom\PycharmProjects\proj3\.venv4\Lib\site-packages\pylint\lint\pylinter.py", line 1034, in get_ast
    raise astroid.AstroidBuildingError(
astroid.exceptions.AstroidBuildingError: Building error when trying to create ast representation of module 'trivial_code'

Expected behavior

No crash.

Pylint version

pylint 4.0.5
astroid 4.2.0b3
Python 3.11.15 (dc0121776214, Apr 28 2026, 06:06:46)
[PyPy 7.3.22 with MSC v.1941 64 bit (AMD64)]

OS / Environment

win32 (Windows)

Additional dependencies


### Expected behavior

Should work on this simple file 
[pylint-crash-2026-06-08-13-23-49.txt](https://github.com/user-attachments/files/28706116/pylint-crash-2026-06-08-13-23-49.txt)


### Pylint version

```shell
pylint 4.0.5
    astroid 4.2.0b3
    Python 3.11.15 (dc0121776214, Apr 28 2026, 06:06:46)
    [PyPy 7.3.22 with MSC v.1941 64 bit (AMD64)]

OS / Environment

Windows 11 / Pycharm

Metadata

Metadata

Assignees

No one assigned

    Labels

    Crash 💥A bug that makes pylint crashNeeds reproduction 🔍Need a way to reproduce it locally on a maintainer's machine

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions