Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pylint-dev/astroid
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.3
Choose a base ref
...
head repository: pylint-dev/astroid
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 3,202 additions and 2,147 deletions.
  1. +5 −0 .git-blame-ignore-revs
  2. +2 −1 .github/workflows/backport.yml
  3. +32 −29 .github/workflows/ci.yaml
  4. +4 −4 .github/workflows/codeql-analysis.yml
  5. +6 −2 .github/workflows/release-tests.yml
  6. +51 −16 .github/workflows/release.yml
  7. +14 −15 .pre-commit-config.yaml
  8. +14 −3 CONTRIBUTORS.txt
  9. +267 −3 ChangeLog
  10. +0 −1 astroid/__init__.py
  11. +1 −1 astroid/__pkginfo__.py
  12. +6 −2 astroid/_ast.py
  13. +1 −5 astroid/_backport_stdlib_names.py
  14. +5 −3 astroid/arguments.py
  15. +19 −14 astroid/bases.py
  16. +3 −5 astroid/brain/brain_argparse.py
  17. +10 −4 astroid/brain/brain_attrs.py
  18. +3 −3 astroid/brain/brain_boto3.py
  19. +21 −16 astroid/brain/brain_builtin_inference.py
  20. +27 −15 astroid/brain/brain_collections.py
  21. +2 −1 astroid/brain/brain_crypt.py
  22. +2 −1 astroid/brain/brain_ctypes.py
  23. +2 −1 astroid/brain/brain_curses.py
  24. +30 −20 astroid/brain/brain_dataclasses.py
  25. +2 −1 astroid/brain/brain_datetime.py
  26. +2 −1 astroid/brain/brain_dateutil.py
  27. +0 −72 astroid/brain/brain_fstrings.py
  28. +2 −1 astroid/brain/brain_functools.py
  29. +2 −0 astroid/brain/brain_gi.py
  30. +5 −6 astroid/brain/brain_hashlib.py
  31. +3 −2 astroid/brain/brain_http.py
  32. +3 −2 astroid/brain/brain_hypothesis.py
  33. +2 −1 astroid/brain/brain_mechanize.py
  34. +37 −31 astroid/brain/brain_namedtuple_enum.py
  35. +2 −2 astroid/brain/brain_nose.py
  36. +2 −1 astroid/brain/brain_numpy_core_fromnumeric.py
  37. +10 −9 astroid/brain/brain_numpy_core_function_base.py
  38. +18 −16 astroid/brain/brain_numpy_core_multiarray.py
  39. +12 −10 astroid/brain/brain_numpy_core_numeric.py
  40. +2 −1 astroid/brain/brain_numpy_core_numerictypes.py
  41. +2 −1 astroid/brain/brain_numpy_core_umath.py
  42. +2 −1 astroid/brain/brain_numpy_ma.py
  43. +2 −2 astroid/brain/brain_numpy_ndarray.py
  44. +2 −1 astroid/brain/brain_numpy_random_mtrand.py
  45. +22 −11 astroid/brain/brain_numpy_utils.py
  46. +5 −2 astroid/brain/brain_pathlib.py
  47. +3 −2 astroid/brain/brain_pkg_resources.py
  48. +2 −1 astroid/brain/brain_pytest.py
  49. +2 −2 astroid/brain/brain_qt.py
  50. +5 −5 astroid/brain/brain_re.py
  51. +4 −5 astroid/brain/brain_regex.py
  52. +2 −1 astroid/brain/brain_responses.py
  53. +2 −1 astroid/brain/brain_scipy_signal.py
  54. +2 −1 astroid/brain/brain_sqlalchemy.py
  55. +11 −5 astroid/brain/brain_ssl.py
  56. +9 −12 astroid/brain/brain_subprocess.py
  57. +2 −1 astroid/brain/brain_threading.py
  58. +8 −8 astroid/brain/brain_type.py
  59. +55 −43 astroid/brain/brain_typing.py
  60. +2 −1 astroid/brain/brain_unittest.py
  61. +0 −2 astroid/brain/helpers.py
  62. +32 −24 astroid/builder.py
  63. +0 −5 astroid/const.py
  64. +12 −11 astroid/context.py
  65. +14 −15 astroid/decorators.py
  66. +1 −3 astroid/exceptions.py
  67. +2 −0 astroid/filter_statements.py
  68. +8 −13 astroid/helpers.py
  69. +1 −1 astroid/inference_tip.py
  70. +136 −78 astroid/interpreter/_import/spec.py
  71. +9 −1 astroid/interpreter/_import/util.py
  72. +20 −39 astroid/interpreter/objectmodel.py
  73. +34 −22 astroid/manager.py
  74. +26 −27 astroid/modutils.py
  75. +10 −8 astroid/nodes/__init__.py
  76. +15 −16 astroid/nodes/_base_nodes.py
  77. +107 −90 astroid/nodes/as_string.py
  78. +185 −75 astroid/nodes/node_classes.py
  79. +20 −39 astroid/nodes/node_ng.py
  80. +3 −1 astroid/nodes/scoped_nodes/__init__.py
  81. +2 −4 astroid/nodes/scoped_nodes/mixin.py
  82. +118 −182 astroid/nodes/scoped_nodes/scoped_nodes.py
  83. +5 −18 astroid/objects.py
  84. +17 −14 astroid/protocols.py
  85. +94 −95 astroid/raw_building.py
  86. +334 −387 astroid/rebuilder.py
  87. +1 −0 astroid/test_utils.py
  88. +28 −17 astroid/transforms.py
  89. +4 −7 astroid/typing.py
  90. +0 −1 doc/api/astroid.exceptions.rst
  91. +1 −1 doc/conf.py
  92. +27 −10 doc/release.md
  93. +2 −2 doc/requirements.txt
  94. +14 −5 pylintrc
  95. +132 −84 pyproject.toml
  96. +1 −2 requirements_dev.txt
  97. +2 −1 requirements_full.txt
  98. +3 −2 requirements_minimal.txt
  99. +20 −1 script/.contributors_aliases.json
  100. +2 −4 script/test_bump_changelog.py
  101. +1 −1 tbump.toml
  102. +32 −28 tests/brain/test_attr.py
  103. +44 −40 tests/brain/test_brain.py
  104. +6 −5 tests/brain/test_builtin.py
  105. +12 −0 tests/brain/test_enum.py
  106. +2 −5 tests/brain/test_hashlib.py
  107. +9 −3 tests/brain/test_pathlib.py
  108. +1 −2 tests/brain/test_regex.py
  109. +14 −0 tests/brain/test_six.py
  110. +21 −0 tests/brain/test_ssl.py
  111. +48 −1 tests/brain/test_typing.py
  112. +0 −2 tests/brain/test_unittest.py
  113. +24 −24 tests/resources.py
  114. +20 −55 tests/test_builder.py
  115. +0 −4 tests/test_constraint.py
  116. +2 −4 tests/test_decorators.py
  117. +3 −2 tests/test_helpers.py
  118. +218 −50 tests/test_inference.py
  119. +1 −20 tests/test_lookup.py
  120. +44 −6 tests/test_manager.py
  121. +56 −1 tests/test_modutils.py
  122. +33 −37 tests/test_nodes.py
  123. +13 −73 tests/test_nodes_lineno.py
  124. +45 −3 tests/test_object_model.py
  125. +34 −3 tests/test_protocols.py
  126. +2 −4 tests/test_python3.py
  127. +30 −11 tests/test_raw_building.py
  128. +33 −11 tests/test_regrtest.py
  129. +12 −15 tests/test_scoped_nodes.py
  130. +31 −2 tests/test_transforms.py
  131. +10 −0 tests/test_type_params.py
  132. 0 tests/testdata/python3/data/cache/__init__.py
  133. +1 −0 tests/testdata/python3/data/cache/a.py
  134. +1 −0 tests/testdata/python3/data/divide_by_zero.py
  135. +11 −0 tests/testdata/python3/data/fake_module_with_collection_getattribute.py
  136. +170 −0 tests/testdata/python3/recursion_error.py
  137. +1 −1 tox.ini
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# Initial formatting of astroid
add5f7b8eba427de9d39caae864bbc6dc37ef980
# Apply black on doc/conf.py
2dd9027054db541871713ef1cb1ae89513d05555
# Black's 2024 style
396f01a15d1cb0351b33654acdeedde64f537a0c
3 changes: 2 additions & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -6,8 +6,9 @@ on:
- labeled

permissions:
pull-requests: write
actions: write
contents: write
pull-requests: write

jobs:
backport:
61 changes: 32 additions & 29 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ on:
env:
CACHE_VERSION: 3
KEY_PREFIX: venv
DEFAULT_PYTHON: "3.11"
DEFAULT_PYTHON: "3.13"
PRE_COMMIT_CACHE: ~/.cache/pre-commit

concurrency:
@@ -24,10 +24,10 @@ jobs:
timeout-minutes: 20
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4.2.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v4.7.0
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
@@ -39,7 +39,7 @@ jobs:
'requirements_full.txt', 'requirements_minimal.txt') }}" >> $GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v3.3.2
uses: actions/cache@v4.2.2
with:
path: venv
key: >-
@@ -59,7 +59,7 @@ jobs:
hashFiles('.pre-commit-config.yaml') }}" >> $GITHUB_OUTPUT
- name: Restore pre-commit environment
id: cache-precommit
uses: actions/cache@v3.3.2
uses: actions/cache@v4.2.2
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: >-
@@ -81,15 +81,15 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
outputs:
python-key: ${{ steps.generate-python-key.outputs.key }}
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4.2.2
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/setup-python@v4.7.0
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
@@ -106,7 +106,7 @@ jobs:
'requirements_full.txt', 'requirements_minimal.txt') }}" >> $GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v3.3.2
uses: actions/cache@v4.2.2
with:
path: venv
key: >-
@@ -117,18 +117,19 @@ jobs:
run: |
python -m venv venv
. venv/bin/activate
python -m pip install -U pip setuptools wheel
python -m pip install -U pip wheel
pip install -U -r requirements_full.txt
pip install -e .
- name: Run pytest
run: |
. venv/bin/activate
pytest --cov
- name: Upload coverage artifact
uses: actions/upload-artifact@v3.1.3
uses: actions/upload-artifact@v4.6.1
with:
name: coverage-linux-${{ matrix.python-version }}
path: .coverage
include-hidden-files: true

tests-windows:
name: tests / run / ${{ matrix.python-version }} / Windows
@@ -138,17 +139,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Set temp directory
run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
# Workaround to set correct temp directory on Windows
# https://github.com/actions/virtual-environments/issues/712
- name: Check out code from GitHub
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4.2.2
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/setup-python@v4.7.0
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
@@ -160,7 +161,7 @@ jobs:
'requirements_full.txt', 'requirements_minimal.txt') }}" >> $GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v3.3.2
uses: actions/cache@v4.2.2
with:
path: venv
key: >-
@@ -179,10 +180,11 @@ jobs:
. venv\\Scripts\\activate
pytest --cov
- name: Upload coverage artifact
uses: actions/upload-artifact@v3.1.3
uses: actions/upload-artifact@v4.6.1
with:
name: coverage-windows-${{ matrix.python-version }}
path: .coverage
include-hidden-files: true

tests-pypy:
name: tests / run / ${{ matrix.python-version }} / Linux
@@ -192,13 +194,13 @@ jobs:
fail-fast: false
matrix:
# We only test on the lowest and highest supported PyPy versions
python-version: ["pypy3.8", "pypy3.10"]
python-version: ["pypy3.9", "pypy3.10"]
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4.2.2
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/setup-python@v4.7.0
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
@@ -210,7 +212,7 @@ jobs:
}}" >> $GITHUB_OUTPUT
- name: Restore Python virtual environment
id: cache-venv
uses: actions/cache@v3.3.2
uses: actions/cache@v4.2.2
with:
path: venv
key: >-
@@ -229,10 +231,11 @@ jobs:
. venv/bin/activate
pytest --cov
- name: Upload coverage artifact
uses: actions/upload-artifact@v3.1.3
uses: actions/upload-artifact@v4.6.1
with:
name: coverage-pypy-${{ matrix.python-version }}
path: .coverage
include-hidden-files: true

coverage:
name: tests / process / coverage
@@ -241,22 +244,22 @@ jobs:
needs: ["tests-linux", "tests-windows", "tests-pypy"]
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4.1.0
- name: Set up Python 3.11
uses: actions/checkout@v4.2.2
- name: Set up Python 3.13
id: python
uses: actions/setup-python@v4.7.0
uses: actions/setup-python@v5.4.0
with:
python-version: "3.11"
python-version: "3.13"
check-latest: true
- name: Install dependencies
run: pip install -U -r requirements_minimal.txt
- name: Download all coverage artifacts
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v4.1.9
- name: Combine Linux coverage results
run: |
coverage combine coverage-linux*/.coverage
coverage xml -o coverage-linux.xml
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
@@ -267,7 +270,7 @@ jobs:
run: |
coverage combine coverage-windows*/.coverage
coverage xml -o coverage-windows.xml
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
@@ -278,7 +281,7 @@ jobs:
run: |
coverage combine coverage-pypy*/.coverage
coverage xml -o coverage-pypy.xml
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -46,11 +46,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4.2.2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -61,7 +61,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@@ -75,4 +75,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
8 changes: 6 additions & 2 deletions .github/workflows/release-tests.yml
Original file line number Diff line number Diff line change
@@ -13,14 +13,18 @@ jobs:
timeout-minutes: 5
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4.2.2
- name: Set up Python 3.9
id: python
uses: actions/setup-python@v4.7.0
uses: actions/setup-python@v5.4.0
with:
# virtualenv 15.1.0 cannot be installed on Python 3.10+
python-version: 3.9
env:
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org"
- name: Create Python virtual environment with virtualenv==15.1.0
env:
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org"
run: |
python -m pip install virtualenv==15.1.0
python -m virtualenv venv2
67 changes: 51 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -6,40 +6,75 @@ on:
- published

env:
DEFAULT_PYTHON: "3.11"
DEFAULT_PYTHON: "3.13"

permissions:
contents: read

jobs:
release-pypi:
name: Upload release to PyPI
build:
name: Build release assets
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/project/astroid/
if: github.event_name == 'release'
steps:
- name: Check out code from Github
uses: actions/checkout@v4.1.0
uses: actions/checkout@v4.2.2
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v4.7.0
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Install requirements
run: |
# Remove dist, build, and astroid.egg-info
# when building locally for testing!
python -m pip install twine build
python -m pip install build
- name: Build distributions
run: |
python -m build
- name: Upload release assets
uses: actions/upload-artifact@v4.6.1
with:
name: release-assets
path: dist/

release-pypi:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: ["build"]
environment:
name: PyPI
url: https://pypi.org/project/astroid/
permissions:
id-token: write
steps:
- name: Download release assets
uses: actions/download-artifact@v4.1.9
with:
name: release-assets
path: dist/
- name: Upload to PyPI
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
env:
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload --verbose dist/*
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1

release-github:
name: Upload assets to Github release
runs-on: ubuntu-latest
needs: ["build"]
permissions:
contents: write
id-token: write
steps:
- name: Download release assets
uses: actions/download-artifact@v4.1.9
with:
name: release-assets
path: dist/
- name: Sign the dists with Sigstore and upload assets to Github release
if: github.event_name == 'release'
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: |
./dist/*.tar.gz
./dist/*.whl
Loading