Use exact signatures for GObject introspection bindings#3046
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3046 +/- ##
==========================================
- Coverage 93.42% 93.23% -0.19%
==========================================
Files 92 92
Lines 11315 11339 +24
==========================================
+ Hits 10571 10572 +1
- Misses 744 767 +23
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Thank you for working on astroid. I didn't check the changes in detail, but the performance impact is worrying. Generally a brain is "dumb" using hard coded and very simple code is fine. Can't we do that for lower cost here ? |
|
Thank you for taking the time to have a brief look at this. I share your concern; that's why I reported the numbers. However, we probably can't speed this up much further. Please keep in mind that the numbers I've reported (additional Maybe some more data for you to have the full picture: For Gtk ( For GLib, a significantly smaller library (1713 functions and 2505 methods), the time spent in the brain for generating all signatures "only" goes up from Anyway, this PR is merely a suggestion from an idea I had since my fix for the pyobject method classification. Feel free to close it if you think this enhancement is not worth the additional cost. 😄 |
Type of Changes
Description
With the recent change to use
inspect.signature()(#2930), instead of generating signatures for all functions and methods with "wildcards" (*args, **kwargs), the exact signature could be provided for better linting.Given the following
example.py... the missing second argument to
set_default_sizecould be reported with a meaningful error message when using exact signatures:Risks
While this feature would substantially improve linting analysis, it would come at a noticeably higher computational cost during module loading time to generate the signatures.
Linting time for the
example.pyaboveLinting time for Apport's
tests/system/test_ui_gtk.pyRefs #2930