Skip to content

Commit c5aced3

Browse files
Add a check for post-load m_copy.
1 parent ae709db commit c5aced3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/test_imp.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,19 @@ def clean_up():
285285
script = textwrap.dedent(f'''
286286
import _testsinglephase
287287
288+
expected = %d
288289
init_count = _testsinglephase.initialized_count()
289-
if init_count != %d:
290+
if init_count != expected:
290291
raise Exception(init_count)
291292
292293
lookedup = _testsinglephase.look_up_self()
293294
if lookedup is not _testsinglephase:
294295
raise Exception((_testsinglephase, lookedup))
296+
297+
# Attrs set after loading are not in m_copy.
298+
if hasattr(_testsinglephase, 'spam'):
299+
raise Exception(_testsinglephase.spam)
300+
_testsinglephase.spam = expected
295301
''')
296302

297303
# Use an interpreter that gets destroyed right away.

0 commit comments

Comments
 (0)