GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-127316: fix incorrect assertion in setting `__class__` in free-thr… · 2union/ircpython@45c5cba

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Lib/test/test_free_threading
    • test_type.py
  • Objects
    • dictobject.c
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Lib/test/test_free_threading/test_type.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_free_threading/test_type.py
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,21 @@ def work():
124124
for thread in threads:
125125
thread.join()
126126

127+
def test_object_class_change(self):
128+
class Base:
129+
def __init__(self):
130+
self.attr = 123
131+
class ClassA(Base):
132+
pass
133+
class ClassB(Base):
134+
pass
135+
136+
obj = ClassA()
137+
# keep reference to __dict__
138+
d = obj.__dict__
139+
obj.__class__ = ClassB
140+
141+
127142
def run_one(self, writer_func, reader_func):
128143
writer = Thread(target=writer_func)
129144
readers = []
Collapse file

‎Objects/dictobject.c‎

Copy file name to clipboardExpand all lines: Objects/dictobject.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7300,7 +7300,7 @@ _PyDict_DetachFromObject(PyDictObject *mp, PyObject *obj)
73007300

73017301
// We could be called with an unlocked dict when the caller knows the
73027302
// values are already detached, so we assert after inline values check.
7303-
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(mp);
7303+
ASSERT_WORLD_STOPPED_OR_OBJ_LOCKED(mp);
73047304
assert(mp->ma_values->embedded == 1);
73057305
assert(mp->ma_values->valid == 1);
73067306
assert(Py_TYPE(obj)->tp_flags & Py_TPFLAGS_INLINE_VALUES);

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.