GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-105227: Add PyType_GetDict() by ericsnowcurrently · Pull Request #105747 · python/cpython Conversation
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| **<<>>**: Names in double angle brackets should be initially set to | ||
| ``NULL`` and treated as read-only after initialization. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Only marking up tp_dict implies it's the only one in this category. At least tp_bases & tp_mro should be marked too.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Yhg1s needs to approve backporting to 3.12 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| replacement for accessing :c:member:`~PyTypeObject.tp_dict` directly. | ||
| The returned dictionary must be treated as read-only. | ||
|
|
||
| This function isn't intended for general use. It's meant for |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If it's not meant for general use, would it be better to add it as unstable API?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I think it makes more sense to say this is for general use.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can you update Doc/data/refcounts.dat, so we get a "Return value: New reference" markup in the docs?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| This function isn't intended for general use. It's meant for | ||
| specific embedding and language-binding cases, where direct access | ||
| to the dict is necessary and indirect access (e.g. via the proxy) | ||
| isn't adequate. Extension modules may continue to use ``tp_dict``, | ||
| directly or indirectly, when setting up their own types. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe elevate this paragraph to a .. note:, or maybe a .. warning:?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| The new :c:func:`PyType_GetDict` provides the dictionary for the given type | ||
| object that is normally exposed by ``cls.__dict__``. Normally it's | ||
| sufficient to use :c:member:`~PyTypeObject.tp_dict`, but for the static | ||
| builtin types ``tp_dict`` is now always ``NULL``. ``PyType_GetDict()`` |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Formatting nit:
| builtin types ``tp_dict`` is now always ``NULL``. ``PyType_GetDict()`` | |
| builtin types :c:member:`!tp_dict` is now always ``NULL``. :c:func:`!PyType_GetDict()` |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Approving the new API as RM: 👍
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| replacement for accessing :c:member:`~PyTypeObject.tp_dict` directly. | ||
| The returned dictionary must be treated as read-only. | ||
|
|
||
| This function isn't intended for general use. It's meant for |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I think it makes more sense to say this is for general use.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Sorry, I last track of which branch I had built CPython from 🐑 . What I meant to say is: I can confirm that the latest version of pyqt6 works with this branch so this change is critical. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
PyQt now uses this call. Strictly speaking it could do the C equivalent of 'cls.dict' but the call is much nicer. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This should make pyqt6 build with Python 3.12. For more infor see: python#105747
This patch should make pyqt6 build with Python 3.12. For more info see: python#105747
|
I'm not available enough to merge this for a few weeks, so anyone that feels comfortable doing so is welcome to in the meantime. 😄 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Any updates on this? This currently blocks me (with qutebrowser, via PyQt) from testing Python 3.12 on CI. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Oh dear, I didn't realis a few weeks is all the time until Beta. And I was busy so it didn't reach the top of my TODO list. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @ericsnowcurrently for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This compensates for static builtin types having `tp_dict` set to `NULL`. (cherry picked from commit a840806) Co-authored-by: Eric Snow <[email protected]> Co-authored-by: Petr Viktorin <[email protected]>
|
GH-106600 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
gh-105227: Add PyType_GetDict() (GH-105747) This compensates for static builtin types having `tp_dict` set to `NULL`. (cherry picked from commit a840806) Co-authored-by: Eric Snow <[email protected]> Co-authored-by: Petr Viktorin <[email protected]>
|
Oh whoops, I wasn't even realizing how close to the Beta 4 I was commenting (apparently it was scheduled for yesterday, but not released yet?)! Glad to hear this still made it in, thanks so much @ericsnowcurrently and @encukou! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
FWIW, this PR was one of the reasons 3.12b4 wasn't cut yesterday :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| .. versionchanged:: 3.12 | ||
|
|
||
| Internals detail: For static builtin types, this is always ``NULL``. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the post merge review, but FYI, there's a directive for implementation details: .. impl-detail::
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for wrapping this up, @encukou! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.