Title: gh-106917: fix super classmethod calls to non-classmethods by carljm · Pull Request #106977 · python/cpython · GitHub
Open Graph Title: gh-106917: fix super classmethod calls to non-classmethods by carljm · Pull Request #106977 · python/cpython
X Title: gh-106917: fix super classmethod calls to non-classmethods by carljm · Pull Request #106977 · python/cpython
Description: The fix for #105035 was subtly incomplete. It checked that cls->tp_getattro == PyObject_GetGenericAttr (as a precondition for attempting the load-method optimization), but what we really need to know is that Py_TYPE(self)->tp_getattro == PyObject_GenericGetAttr. In the typical case of super(MyClass, instance)... these are effectively the same thing (instance will be an instance of MyClass), but in a classmethod super() call (super(MyClass, MyClass)...) they are quite different; the type of MyClass is type, which has a different tp_getattro. For actual classmethods this was fine; the load-method optimization still works correctly for classmethods looked up on types. But it doesn't work for regular methods (plain function objects) looked up on types; those are just regular function calls with no bound method behavior. It's pretty unusual to use classmethod-style super where the call target is a regular function, not a classmethod. But it can occur, e.g. if using super with __new__ and dynamically-assigned __new__ methods, as in #106917. Issue: gh-106917
Open Graph Description: The fix for #105035 was subtly incomplete. It checked that cls->tp_getattro == PyObject_GetGenericAttr (as a precondition for attempting the load-method optimization), but what we really need to...
X Description: The fix for #105035 was subtly incomplete. It checked that cls->tp_getattro == PyObject_GetGenericAttr (as a precondition for attempting the load-method optimization), but what we really nee...
Opengraph URL: https://github.com/python/cpython/pull/106977
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:72cb25e9-7828-37b4-d8d4-381d2cbf84d3 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | C996:1672C1:5D84C2:7A6C69:696AE671 |
| html-safe-nonce | 05c492850078bae8b1749137606c8390744eb0583d8e722219bf96ced1c0f98b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTk2OjE2NzJDMTo1RDg0QzI6N0E2QzY5OjY5NkFFNjcxIiwidmlzaXRvcl9pZCI6IjQzNTA0NDM4Njk5MTI2MjI3MDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0ba214435a06a88c0639713121be2b74d3cbb0658504b09cf25afb9473042c91 |
| hovercard-subject-tag | pull_request:1445028723 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/python/cpython/pull/106977/checks |
| twitter:image | https://avatars.githubusercontent.com/u/61586?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/61586?s=400&v=4 |
| og:image:alt | The fix for #105035 was subtly incomplete. It checked that cls->tp_getattro == PyObject_GetGenericAttr (as a precondition for attempting the load-method optimization), but what we really need to... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3d84d50b3c75fa36755c3cf392edbc09e626f979 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width