Title: Fix advanced class completion by gpotter2 · Pull Request #932 · bpython/bpython · GitHub
Open Graph Title: Fix advanced class completion by gpotter2 · Pull Request #932 · bpython/bpython
X Title: Fix advanced class completion by gpotter2 · Pull Request #932 · bpython/bpython
Description: This PR removes a check that always tried to autocomplete a class using its __init__ function. In fact, the inspect module (used afterwards in bpython/bpython/inspection.py Line 286 in f9b21ca signature = inspect.signature(f) ) does a much better job at finding the arguments that are actually typing a class, which aren't always the ones in __init__. Since at least Python 3.6, it handles __call__, __new__ and __signature__ in addition to __init__, so restricting the signatures to __init__ is actually a downgrade. See https://github.com/python/cpython/blob/2c56c97f015a7ea81719615ddcf3c745fba5b4f3/Lib/inspect.py#L2284 I'm raising this issue because our CLI requires __signature__ to work, which is the case if you let inspect.signature do its job by default but not if you manually select cls.__init__ 🙂 Note: I also doubt that the __new__ check below is useful on modern Python versions, since __new__ is also checked by inspect.signature (therefore by inspection.getfuncprops), but I didn't remove it in this PR.
Open Graph Description: This PR removes a check that always tried to autocomplete a class using its __init__ function. In fact, the inspect module (used afterwards in bpython/bpython/inspection.py ...
X Description: This PR removes a check that always tried to autocomplete a class using its __init__ function. In fact, the inspect module (used afterwards in bpython/bpython/inspection.py ...
Opengraph URL: https://github.com/bpython/bpython/pull/932
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:4dd18bf1-20eb-8061-1536-5bfa3820025d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D7DC:2569B3:192787F:223AC91:696758B8 |
| html-safe-nonce | 7ea3345a7cfc33c9b2fb8a7ca25ec999683d43b64975f3c4950c26381ff075c3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0RDOjI1NjlCMzoxOTI3ODdGOjIyM0FDOTE6Njk2NzU4QjgiLCJ2aXNpdG9yX2lkIjoiNjY0NzAyOTA2ODUyOTYyMTE3NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6e24fb58d149a1cb30255b586f1f3b7581aec99826b76cb2a4466da9522621b5 |
| hovercard-subject-tag | pull_request:763209707 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/bpython/bpython/pull/932/files |
| twitter:image | https://avatars.githubusercontent.com/u/10530980?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/10530980?s=400&v=4 |
| og:image:alt | This PR removes a check that always tried to autocomplete a class using its __init__ function. In fact, the inspect module (used afterwards in bpython/bpython/inspection.py ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1a6a4ac66aaa8be0077b72a69fd56fb51cd11215a1e31f0365079e012987234a |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/bpython/bpython git https://github.com/bpython/bpython.git |
| octolytics-dimension-user_id | 8071396 |
| octolytics-dimension-user_login | bpython |
| octolytics-dimension-repository_id | 21508865 |
| octolytics-dimension-repository_nwo | bpython/bpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 21508865 |
| octolytics-dimension-repository_network_root_nwo | bpython/bpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 045909cd564d790cacd96dcb8722039dff679d63 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width