René's URL Explorer Experiment


Title: 3.12.0b1 includes backwards incompatible change to operation of `super()` · Issue #105035 · python/cpython · GitHub

Open Graph Title: 3.12.0b1 includes backwards incompatible change to operation of `super()` · Issue #105035 · python/cpython

X Title: 3.12.0b1 includes backwards incompatible change to operation of `super()` · Issue #105035 · python/cpython

Description: Bug report The optimisation to LOAD_SUPER_ATTR introduced by #104270 appears to have introduced a backwards incompatibility. The following code will reproduce the problem: class MyInstance: def __new__(cls, ptr, name, bases, attrs): self...

Open Graph Description: Bug report The optimisation to LOAD_SUPER_ATTR introduced by #104270 appears to have introduced a backwards incompatibility. The following code will reproduce the problem: class MyInstance: def __n...

X Description: Bug report The optimisation to LOAD_SUPER_ATTR introduced by #104270 appears to have introduced a backwards incompatibility. The following code will reproduce the problem: class MyInstance: def __n...

Opengraph URL: https://github.com/python/cpython/issues/105035

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"3.12.0b1 includes backwards incompatible change to operation of `super()`","articleBody":"# Bug report\r\n\r\nThe optimisation to LOAD_SUPER_ATTR introduced by #104270 appears to have introduced a backwards incompatibility.\r\n\r\nThe following code will reproduce the problem:\r\n```\r\nclass MyInstance:\r\n    def __new__(cls, ptr, name, bases, attrs):\r\n        self = super().__new__(cls, name, bases, attrs)\r\n        print(f\"{MyInstance=} {self=} {type(self)=}, {super(MyInstance, type(self))=}\")\r\n        super(MyInstance, type(self)).__setattr__(self, \"ptr\", ptr)\r\n        return self\r\n\r\n    def __setattr__(self, name, value):\r\n        raise Exception()\r\n\r\n\r\nclass MyClass(MyInstance, type):\r\n    def __new__(cls, name):\r\n        self = super().__new__(cls, id(name), name, (MyInstance,), {})\r\n\r\n        return self\r\n\r\n\r\nclass1 = MyClass(\"Class1\")\r\nprint(f\"{class1.ptr=}\")\r\n\r\nclass2 = MyClass(\"Class2\")\r\nprint(f\"{class2.ptr=}\")\r\n```\r\nUnder 3.12.0a7 (and previous stable Python versions going back to at least 3.7), this will succeed, outputting:\r\n```\r\nMyInstance=\u003cclass '__main__.MyInstance'\u003e self=\u003cclass '__main__.Class1'\u003e type(self)=\u003cclass '__main__.MyClass'\u003e, super()=\u003csuper: \u003cclass 'MyInstance'\u003e, \u003cMyClass object\u003e\u003e\r\nclass1.ptr=4364457392\r\nMyInstance=\u003cclass '__main__.MyInstance'\u003e self=\u003cclass '__main__.Class2'\u003e type(self)=\u003cclass '__main__.MyClass'\u003e, super()=\u003csuper: \u003cclass 'MyInstance'\u003e, \u003cMyClass object\u003e\u003e\r\nclass2.ptr=4365761904\r\n```\r\n\r\nUnder 3.12.0b1, it raises an error:\r\n```\r\nMyInstance=\u003cclass '__main__.MyInstance'\u003e self=\u003cclass '__main__.Class1'\u003e type(self)=\u003cclass '__main__.MyClass'\u003e, super()=\u003csuper: \u003cclass 'MyInstance'\u003e, \u003cMyClass object\u003e\u003e\r\nclass1.ptr=4370144336\r\nMyInstance=\u003cclass '__main__.MyInstance'\u003e self=\u003cclass '__main__.Class2'\u003e type(self)=\u003cclass '__main__.MyClass'\u003e, super()=\u003csuper: \u003cclass 'MyInstance'\u003e, \u003cMyClass object\u003e\u003e\r\nTraceback (most recent call last):\r\n  File \"/Users/rkm/beeware/rubicon/objc/repro.py\", line 24, in \u003cmodule\u003e\r\n    class2 = MyClass(\"Class2\")\r\n             ^^^^^^^^^^^^^^^^^\r\n  File \"/Users/rkm/beeware/rubicon/objc/repro.py\", line 16, in __new__\r\n    self = super().__new__(cls, id(name), name, (MyInstance,), {})\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/Users/rkm/beeware/rubicon/objc/repro.py\", line 7, in __new__\r\n    super().__setattr__(self, \"ptr\", ptr)\r\nTypeError:  expected 2 arguments, got 3\r\n```\r\n\r\nThat is - the first `MyClass` instance can be instantiated; however, the second instance fails in mid-construction when invoking `__setattr__`. The state of the objects prior to the `__setattr__` invocation appear to be identical, but the `__setattr__` method behaves differently on the second invocation.\r\n\r\nGit bisect has narrowed the cause down to #104270 (CC @carljm, @markshannon).\r\n\r\nThe reproduction case also fails if the call to `super`:\r\n```\r\n        super(MyInstance, type(self)).__setattr__(self, \"ptr\", ptr)\r\n```\r\nis replaced with the simpler:\r\n```\r\n        super().__setattr__(self, \"ptr\", ptr)\r\n```\r\n## Background\r\n\r\nThis test case has been extracted from [rubicon-objc](https://github.com/beeware/rubicon-objc), causing beeware/rubicon-objc#313. Rubicon is a wrapper around the Objective C runtime used by macOS and iOS; `MyInstance` is an analog of `ObjCInstance`, and `MyClass` is a an analog of `ObjCClass`. `ObjCInstance` has an implementation of `__setattr__` to redirect attribute access to the underlying ObjC calls. However, during construction, `ObjCInstance` needs to store a `ptr` of the underlying ObjC instance. This isn't a valid ObjC attribute, so `super()` is used to access the underlying `__setattr__` implementation to set the attribute.\r\n\r\n# Your environment\r\n\r\n- CPython versions tested on: 3.7.9, 3.10.11, 3.12.0a7, 3.12.0b1\r\n- Operating system and architecture: macOS ARM64\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-105094\n* gh-105117\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/freakboy3742","@type":"Person","name":"freakboy3742"},"datePublished":"2023-05-28T04:34:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/105035/cpython/issues/105035"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:26507364-13ad-cc06-c2fc-b1d21580c793
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id973C:217FCE:F6F29E:154C17D:6969F260
html-safe-noncebf7b5cc36894fffe7be4315b1a09b9cede9f79ec6a7d9e198a79bf24e19840fa
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzNDOjIxN0ZDRTpGNkYyOUU6MTU0QzE3RDo2OTY5RjI2MCIsInZpc2l0b3JfaWQiOiI1NzU1MzA4ODA3Njc0ODg2MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac95f4b50ca342c230b0bd9e2e3d6c0a5984489d5e9ec59ed7e893009f72ac032f
hovercard-subject-tagissue:1729164357
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/105035/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e99715abd089bd0a5eee7330ece058f0c5100751cf3713f9e12ad7ee32bde600/python/cpython/issues/105035
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e99715abd089bd0a5eee7330ece058f0c5100751cf3713f9e12ad7ee32bde600/python/cpython/issues/105035
og:image:altBug report The optimisation to LOAD_SUPER_ATTR introduced by #104270 appears to have introduced a backwards incompatibility. The following code will reproduce the problem: class MyInstance: def __n...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefreakboy3742
hostnamegithub.com
expected-hostnamegithub.com
None7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasebdde15ad1b403e23b08bbd89b53fbe6bdf688cad
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/105035#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F105035
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F105035
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/105035
Reloadhttps://github.com/python/cpython/issues/105035
Reloadhttps://github.com/python/cpython/issues/105035
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/105035
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/issues/105035
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/105035
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/105035
3.12.0b1 includes backwards incompatible change to operation of super()https://github.com/python/cpython/issues/105035#top
https://github.com/carljm
3.12only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.12%22
3.13bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/freakboy3742
https://github.com/freakboy3742
freakboy3742https://github.com/freakboy3742
on May 28, 2023https://github.com/python/cpython/issues/105035#issue-1729164357
#104270https://github.com/python/cpython/pull/104270
#104270https://github.com/python/cpython/pull/104270
@carljmhttps://github.com/carljm
@markshannonhttps://github.com/markshannon
rubicon-objchttps://github.com/beeware/rubicon-objc
beeware/rubicon-objc#313https://github.com/beeware/rubicon-objc/issues/313
gh-105035: fix super() calls on unusual types (e.g. meta-types) #105094https://github.com/python/cpython/pull/105094
[3.12] gh-105035: fix super() calls on unusual types (e.g. meta-types) (GH-105094) #105117https://github.com/python/cpython/pull/105117
carljmhttps://github.com/carljm
3.12only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.12%22
3.13bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.