Title: bpo-38603: Inherit docstrings in dynamically generated subclasses if possible by anntzer · Pull Request #16957 · python/cpython · GitHub
Open Graph Title: bpo-38603: Inherit docstrings in dynamically generated subclasses if possible by anntzer · Pull Request #16957 · python/cpython
X Title: bpo-38603: Inherit docstrings in dynamically generated subclasses if possible by anntzer · Pull Request #16957 · python/cpython
Description: Currently, inspect.getdoc() fails to inherit docstrings in dynamically
generated subclasses, such as
class Base:
def method(self): "some docstring"
def make_subclass():
class subclass(Base):
def method(self): return super().method()
return subclass
subclass = make_subclass()
inspect.getdoc(subclass.method) # => returns None
because inspect._findclass() tries to find the base
class by parsing subclass.method.__qualname__ which is
"make_subclass.
Open Graph Description: Currently, inspect.getdoc() fails to inherit docstrings in dynamically generated subclasses, such as class Base: def method(self): "some docstring" def make_subclass(): class sub...
X Description: Currently, inspect.getdoc() fails to inherit docstrings in dynamically generated subclasses, such as class Base: def method(self): "some docstring" def make_subclass(): c...
Opengraph URL: https://github.com/python/cpython/pull/16957
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:1546c118-6e4e-4115-9f76-88fab2bf781d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C800:2BF803:DC628C:13ED37E:6A54AC6C |
| html-safe-nonce | 9aeaae2683f5084e5f6a3a44dcb9188c1d9bfcbad3c670e8743446ebff3c4db7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODAwOjJCRjgwMzpEQzYyOEM6MTNFRDM3RTo2QTU0QUM2QyIsInZpc2l0b3JfaWQiOiIzODgxODQ0OTYzNDk2MjA5NTE2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7328aed4d0ae8f6b59f6c7c11b6d830c6d1b8d27ca68296ed42acb1d577646a1 |
| hovercard-subject-tag | pull_request:332865687 |
| 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/python/cpython/pull/16957/files |
| twitter:image | https://avatars.githubusercontent.com/u/1322974?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1322974?s=400&v=4 |
| og:image:alt | Currently, inspect.getdoc() fails to inherit docstrings in dynamically generated subclasses, such as class Base: def method(self): "some docstring" def make_subclass(): class sub... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f8cfff6384f62259baea531c7f58bc7040f8dd92 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width