summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2008-06-12 09:50:58 (GMT)
committerArmin Rigo <arigo@tunes.org>2008-06-12 09:50:58 (GMT)
commitffae306784a067c9a604856e0886fa9d5e716337 (patch)
treefea3195d717c6ea8b68f7869fb2f391595840018 /Lib/test
parent5cc774e2324f8c536fcdd99d839507b1c26a10f1 (diff)
downloadcpython-ffae306784a067c9a604856e0886fa9d5e716337.zip
cpython-ffae306784a067c9a604856e0886fa9d5e716337.tar.gz
cpython-ffae306784a067c9a604856e0886fa9d5e716337.tar.bz2
Sounds obvious, but I didn't even realize that you can put non-string
keys in type dictionaries without using this locals() hack.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/crashers/loosing_mro_ref.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/test/crashers/loosing_mro_ref.py b/Lib/test/crashers/loosing_mro_ref.py
index f0b8047..b5fa93b 100644
--- a/Lib/test/crashers/loosing_mro_ref.py
+++ b/Lib/test/crashers/loosing_mro_ref.py
@@ -27,10 +27,9 @@ class Base(object):
class Base2(object):
mykey = 'from Base2'
-class X(Base):
- # you can't add a non-string key to X.__dict__, but it can be
- # there from the beginning :-)
- locals()[MyKey()] = 5
+# you can't add a non-string key to X.__dict__, but it can be
+# there from the beginning :-)
+X = type('X', (Base,), {MyKey(): 5})
print X.mykey
# I get a segfault, or a slightly wrong assertion error in a debug build.