René's URL Explorer Experiment


Title: Breaking backward compatibility between `ctypes` and metaclasses in Python 3.13. · Issue #124520 · python/cpython · GitHub

Open Graph Title: Breaking backward compatibility between `ctypes` and metaclasses in Python 3.13. · Issue #124520 · python/cpython

X Title: Breaking backward compatibility between `ctypes` and metaclasses in Python 3.13. · Issue #124520 · python/cpython

Description: Documentation Background I am one of the maintainers of comtypes. comtypes is based on ctypes and uses metaclasses to implement IUnknown. It was reported to the comtypes community that an error occurs when attempting to use conventional ...

Open Graph Description: Documentation Background I am one of the maintainers of comtypes. comtypes is based on ctypes and uses metaclasses to implement IUnknown. It was reported to the comtypes community that an error occ...

X Description: Documentation Background I am one of the maintainers of comtypes. comtypes is based on ctypes and uses metaclasses to implement IUnknown. It was reported to the comtypes community that an error occ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Breaking backward compatibility between `ctypes` and metaclasses in Python 3.13.","articleBody":"# Documentation\r\n\r\n\r\n## Background\r\nI am one of the maintainers of [`comtypes`](https://github.com/enthought/comtypes/). `comtypes` is based on `ctypes` and uses metaclasses to implement [`IUnknown`](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nn-unknwn-iunknown).\r\n\r\nIt was reported to the `comtypes` community that [an error occurs when attempting to use conventional metaclasses with Python 3.13](https://github.com/enthought/comtypes/issues/618#issuecomment-2366905288).\r\n\r\nA similar error was encountered in [`pyglet`](https://github.com/pyglet/pyglet), which also uses metaclasses to implement COM interfaces, when running on Python 3.13.\r\n\r\nBy referring to https://github.com/pyglet/pyglet/issues/1196 and https://github.com/pyglet/pyglet/pull/1199, I made several modifications to the code through trial and error, and now `comtypes` works in both Python 3.13 and earlier versions without problems:\r\n- https://github.com/enthought/comtypes/compare/a3a8733..04b766a\r\n  - It is necessary to pass arguments directly to the metaclass instead of using `__new__` in places where the metaclass is instantiated (i.e., where the class is dynamically defined). This also works in versions prior to Python 3.13.\r\n  - After calling `type.__new__`, any remaining initialization would be handled in `__init__` instead of in `__new__`. Since this results in an error in versions prior to Python 3.13, a bridge using `sys.version_info` is necessary.\r\n\r\nI think these changes are likely related to https://github.com/python/cpython/issues/114314 and https://github.com/python/cpython/issues/117142 and were introduced by the PRs linked to those issues.\r\n\r\nSince this change to `ctypes` breaks compatibility, I think it should be mentioned in the [What’s New In Python 3.13](https://docs.python.org/3.13/whatsnew/3.13.html) and/or in the [`ctypes` documentation](https://docs.python.org/3.13/library/ctypes.html).\r\nThere are likely other projects besides `comtypes` and `pyglet` that rely on the combination of `ctypes` and metaclasses, and I want to prevent confusion for those maintainers when they try to support Python 3.13.\r\n\r\n(Additionally, I would like to ask with the `ctypes` maintainers to confirm whether the changes for the metaclasses in `comtypes` (and `pyglet`) are appropriate.)\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-124546\n* gh-124708\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/junkmd","@type":"Person","name":"junkmd"},"datePublished":"2024-09-25T15:14:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":19},"url":"https://github.com/124520/cpython/issues/124520"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:19ccf05e-5d51-be49-0125-e2cafaec1d1b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8144:2786B7:1CEA84:26913E:6969CA3D
html-safe-nonce8163cce469336c9dc24c77189c00c02c1879bea8c2a18e55bc18e2f6fb5a7dd6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTQ0OjI3ODZCNzoxQ0VBODQ6MjY5MTNFOjY5NjlDQTNEIiwidmlzaXRvcl9pZCI6IjU0MjUzMTY3NDc3ODAxNDc3NzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace01adec055d43672a599a6afc27a54b01f68a4b0a38e9f3adb5bea4f862bb839
hovercard-subject-tagissue:2548280606
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/124520/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8bf6473ef821e4459925123cbb700ad09d1e1c8f650d48eab68c9810234bf35f/python/cpython/issues/124520
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8bf6473ef821e4459925123cbb700ad09d1e1c8f650d48eab68c9810234bf35f/python/cpython/issues/124520
og:image:altDocumentation Background I am one of the maintainers of comtypes. comtypes is based on ctypes and uses metaclasses to implement IUnknown. It was reported to the comtypes community that an error occ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejunkmd
hostnamegithub.com
expected-hostnamegithub.com
Noneacedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056
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
release83c08c21cdda978090dc44364b71aa5bc6dcea79
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/124520#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F124520
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%2F124520
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/124520
Reloadhttps://github.com/python/cpython/issues/124520
Reloadhttps://github.com/python/cpython/issues/124520
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/124520
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/124520
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/124520
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/124520
Breaking backward compatibility between ctypes and metaclasses in Python 3.13.https://github.com/python/cpython/issues/124520#top
3.13bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
docsDocumentation in the Doc dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22docs%22
topic-ctypeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-ctypes%22
https://github.com/junkmd
https://github.com/junkmd
junkmdhttps://github.com/junkmd
on Sep 25, 2024https://github.com/python/cpython/issues/124520#issue-2548280606
comtypeshttps://github.com/enthought/comtypes/
IUnknownhttps://learn.microsoft.com/en-us/windows/win32/api/unknwn/nn-unknwn-iunknown
an error occurs when attempting to use conventional metaclasses with Python 3.13https://github.com/enthought/comtypes/issues/618#issuecomment-2366905288
pyglethttps://github.com/pyglet/pyglet
pyglet/pyglet#1196https://github.com/pyglet/pyglet/issues/1196
pyglet/pyglet#1199https://github.com/pyglet/pyglet/pull/1199
https://github.com/enthought/comtypes/compare/a3a8733..04b766ahttps://github.com/enthought/comtypes/compare/a3a8733..04b766a
#114314https://github.com/python/cpython/issues/114314
#117142https://github.com/python/cpython/issues/117142
What’s New In Python 3.13https://docs.python.org/3.13/whatsnew/3.13.html
ctypes documentationhttps://docs.python.org/3.13/library/ctypes.html
gh-124520: What's New entry for ctypes metaclass __new__/__init__ change #124546https://github.com/python/cpython/pull/124546
[3.13] gh-124520: What's New entry for ctypes metaclass __new__/__init__ change (GH-124546) #124708https://github.com/python/cpython/pull/124708
3.13bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
docsDocumentation in the Doc dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22docs%22
topic-ctypeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-ctypes%22
Release and Deferred blockers 🚫https://github.com/orgs/python/projects/2
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.