Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add side effect note; apply review suggestions for test
Co-authored-by: Jelle Zijlstra <[email protected]>
  • Loading branch information
encukou and JelleZijlstra authored Aug 15, 2025
commit 1909b6d90086fda1d09fab5112ac6f90f2d851ea
1 change: 1 addition & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ Other language changes
* The :attr:`~object.__dict__` and :attr:`!__weakref__` descriptors now use a
single descriptor instance per interpreter, shared across all types that
need them.
Comment thread
encukou marked this conversation as resolved.
This speeds up class creation, and helps avoid reference cycles.
(Contributed by Petr Viktorin in :gh:`135228`.)


Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_descr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6070,11 +6070,11 @@ class IntSubclass(int):
None,
)
with self.assertRaises(AttributeError):
print(weakref_descriptor.__get__(True, bool))
weakref_descriptor.__get__(True, bool)
with self.assertRaises(AttributeError):
print(weakref_descriptor.__get__(SlotClass(), SlotClass))
weakref_descriptor.__get__(SlotClass(), SlotClass)
with self.assertRaises(AttributeError):
print(weakref_descriptor.__get__(IntSubclass(), IntSubclass))
weakref_descriptor.__get__(IntSubclass(), IntSubclass)


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
The :attr:`object.__dict__` and :attr:`!__weakref__` descriptors now use a
single descriptor instance per interpreter, shared across all types that
need them.
Comment thread
encukou marked this conversation as resolved.
This speeds up class creation, and helps avoid reference cycles.