summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-10-20 21:50:28 (GMT)
committerBenjamin Peterson <benjamin@python.org>2013-10-20 21:50:28 (GMT)
commit6b4f7803f8be4b90c22dcf3737f4144cabff4d70 (patch)
treec0db1b6ecbe9b239c7fa6d741fb82eaf71a0fd7e /Lib
parenta7a150c7c65e8022027ed0f48cd6f867fcf31949 (diff)
downloadcpython-6b4f7803f8be4b90c22dcf3737f4144cabff4d70.zip
cpython-6b4f7803f8be4b90c22dcf3737f4144cabff4d70.tar.gz
cpython-6b4f7803f8be4b90c22dcf3737f4144cabff4d70.tar.bz2
cleanup the construction of __qualname__ (closes #19301 again)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/importlib/_bootstrap.py3
-rw-r--r--Lib/test/test_descr.py4
-rw-r--r--Lib/test/test_funcattrs.py5
3 files changed, 9 insertions, 3 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index e8eeea1..ec10532 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -370,12 +370,13 @@ def _call_with_frames_removed(f, *args, **kwds):
# Python 3.4a1 3270 (various tweaks to the __class__ closure)
# Python 3.4a1 3280 (remove implicit class argument)
# Python 3.4a4 3290 (changes to __qualname__ computation)
+# Python 3.4a4 3300 (more changes to __qualname__ computation)
#
# MAGIC must change whenever the bytecode emitted by the compiler may no
# longer be understood by older implementations of the eval loop (usually
# due to the addition of new opcodes).
-MAGIC_NUMBER = (3290).to_bytes(2, 'little') + b'\r\n'
+MAGIC_NUMBER = (3300).to_bytes(2, 'little') + b'\r\n'
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c
_PYCACHE = '__pycache__'
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 90efb27..595d540 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4519,8 +4519,10 @@ order (MRO) for bases """
global Y
class Y:
- pass
+ class Inside:
+ pass
self.assertEqual(Y.__qualname__, 'Y')
+ self.assertEqual(Y.Inside.__qualname__, 'Y.Inside')
def test_qualname_dict(self):
ns = {'__qualname__': 'some.name'}
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py
index 1d8fa13..5094f7b 100644
--- a/Lib/test/test_funcattrs.py
+++ b/Lib/test/test_funcattrs.py
@@ -9,7 +9,9 @@ def global_function():
pass
global inner_global_function
def inner_global_function():
- pass
+ def inner_function2():
+ pass
+ return inner_function2
return LocalClass
return lambda: inner_function
@@ -120,6 +122,7 @@ class FunctionPropertiesTest(FuncAttrsTest):
self.assertEqual(global_function()()().__qualname__,
'global_function.<locals>.inner_function.<locals>.LocalClass')
self.assertEqual(inner_global_function.__qualname__, 'inner_global_function')
+ self.assertEqual(inner_global_function().__qualname__, 'inner_global_function.<locals>.inner_function2')
self.b.__qualname__ = 'c'
self.assertEqual(self.b.__qualname__, 'c')
self.b.__qualname__ = 'd'