Title: Support pickling of super object · Issue #125767 · python/cpython · GitHub
Open Graph Title: Support pickling of super object · Issue #125767 · python/cpython
X Title: Support pickling of super object · Issue #125767 · python/cpython
Description: Feature or enhancement As was noted in #125714 (comment), the super object is not pickleable. For example: import pickle class X: pass s = super(X, X()) pickle.dumps(s) Produces a traceback: Traceback (most recent call last): File " Open Graph Description: Feature or enhancement As was noted in #125714 (comment), the super object is not pickleable. For example: import pickle class X: pass s = super(X, X()) pickle.dumps(s) Produces a traceback: Traceb...
X Description: Feature or enhancement As was noted in #125714 (comment), the super object is not pickleable. For example: import pickle class X: pass s = super(X, X()) pickle.dumps(s) Produces a traceback: Traceb...
Opengraph URL: https://github.com/python/cpython/issues/125767
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support pickling of super object","articleBody":"# Feature or enhancement\n\nAs was noted in https://github.com/python/cpython/issues/125714#issuecomment-2423259145, the `super` object is not pickleable. For example:\n\n```py\nimport pickle\nclass X: pass\ns = super(X, X())\npickle.dumps(s)\n```\nProduces a traceback:\n```pytb\nTraceback (most recent call last):\n File \"\u003cpython-input-0\u003e\", line 4, in \u003cmodule\u003e\n pickle.dumps(s)\n ~~~~~~~~~~~~^^^\n_pickle.PicklingError: first argument to __newobj__() must be \u003cclass 'super'\u003e, not \u003cclass '__main__.X'\u003e\nwhen serializing super object\n```\nThis is because the special methods like `__reduce_ex__()` are looked up in an instance and translated to a lookup in the underlying object.\n```pycon\n\u003e\u003e\u003e super(X, X()).__reduce_ex__(5)\n(\u003cfunction __newobj__ at 0x7fd9e8a0ad50\u003e, (\u003cclass '__main__.X'\u003e,), None, None, None)\n```\nThis cannot be solved by implementing the `__reduce_ex__()` method in the `super` class, because the current behavior is expected when `super()` is used in the `__reduce_ex__()` implementation of some subclass. The `super` class likely should be registered in the global dispatch table.\n\nThere may be similar issue with shallow and deep copying.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-125781\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2024-10-21T06:04:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/125767/cpython/issues/125767"}
route-pattern /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) route-controller voltron_issues_fragments route-action issue_layout fetch-nonce v2:96d7c23d-f723-d8ce-e57e-1708496c17a5 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id A1E8:14453C:6EDFE8:945CC9:6A530290 html-safe-nonce 229dd5eca536dd28efc1f8263f3559fcfea4419555491a0c82a7a2e5605f472e visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMUU4OjE0NDUzQzo2RURGRTg6OTQ1Q0M5OjZBNTMwMjkwIiwidmlzaXRvcl9pZCI6IjUwNTY3MjQxNzM3NDU2OTEwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 visitor-hmac 4179d0a7a5e3ac2798d0337a70189914a9eb7bc8b0cc08d0a6ad5e30bdb13376 hovercard-subject-tag issue:2601439046 github-keyboard-shortcuts repository,issues,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/_view_fragments/issues/show/python/cpython/125767/issue_layout twitter:image https://opengraph.githubassets.com/935fbf5b0de69416dc8049cce6d517145b603dec321d391cb06f1a6e7addc05a/python/cpython/issues/125767 twitter:card summary_large_image og:image https://opengraph.githubassets.com/935fbf5b0de69416dc8049cce6d517145b603dec321d391cb06f1a6e7addc05a/python/cpython/issues/125767 og:image:alt Feature or enhancement As was noted in #125714 (comment), the super object is not pickleable. For example: import pickle class X: pass s = super(X, X()) pickle.dumps(s) Produces a traceback: Traceb... og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username serhiy-storchaka hostname github.com expected-hostname github.com None b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb 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 disable-turbo false browser-stats-url https://api.github.com/_private/browser/stats browser-errors-url https://api.github.com/_private/browser/errors release 07a982c1d40157c619b364352b704c3ce66bb332 ui-target full theme-color #1e2327 color-scheme light dark
URLs of crawlers that visited me.