Fix builtin functions incorrectly exposing descriptor attributes#2983
Merged
DanielNoord merged 2 commits intopylint-dev:mainfrom Mar 2, 2026
Merged
Conversation
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2983 +/- ##
==========================================
- Coverage 93.30% 93.27% -0.04%
==========================================
Files 92 92
Lines 11309 11341 +32
==========================================
+ Hits 10552 10578 +26
- Misses 757 763 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Member
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
Thank you, looks good !
Pierre-Sassoulas
previously approved these changes
Feb 28, 2026
DanielNoord
approved these changes
Mar 2, 2026
pylint-backport bot
pushed a commit
that referenced
this pull request
Mar 2, 2026
Fix builtin functions incorrectly exposing descriptor attributes Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> (cherry picked from commit 85226dd)
DanielNoord
added a commit
that referenced
this pull request
Mar 2, 2026
Fix builtin functions incorrectly exposing descriptor attributes Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> (cherry picked from commit 85226dd)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Changes
Description
Builtin functions like
eval,print, andlendon't have__get__,__defaults__,__annotations__, etc. in Python - they'rebuiltin_function_or_method, not regular functions. But astroid was returning values for these anyway sinceFunctionModeldidn't distinguish between builtins and user-defined functions. This PR adds a check to raiseAttributeInferenceErrorfor these attributes on builtins, same as Python would raiseAttributeError.Closes #2743