mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
Issue #24254: Drop cls.__definition_order__.
This commit is contained in:
parent
7f730cf01d
commit
4f29e75289
16 changed files with 193 additions and 533 deletions
|
@ -180,7 +180,7 @@ Use a metaclass that doesn't derive from type.
|
|||
meta: C ()
|
||||
ns: [('__module__', 'test.test_metaclass'), ('__qualname__', 'C'), ('a', 42), ('b', 24)]
|
||||
kw: []
|
||||
>>> type(C) is types._DefaultClassNamespaceType
|
||||
>>> type(C) is dict
|
||||
True
|
||||
>>> print(sorted(C.items()))
|
||||
[('__module__', 'test.test_metaclass'), ('__qualname__', 'C'), ('a', 42), ('b', 24)]
|
||||
|
@ -211,11 +211,8 @@ And again, with a __prepare__ attribute.
|
|||
|
||||
The default metaclass must define a __prepare__() method.
|
||||
|
||||
>>> ns = type.__prepare__()
|
||||
>>> type(ns) is types._DefaultClassNamespaceType
|
||||
True
|
||||
>>> list(ns) == []
|
||||
True
|
||||
>>> type.__prepare__()
|
||||
{}
|
||||
>>>
|
||||
|
||||
Make sure it works with subclassing.
|
||||
|
@ -251,9 +248,7 @@ Test failures in looking up the __prepare__ method work.
|
|||
|
||||
"""
|
||||
|
||||
from collections import OrderedDict
|
||||
import sys
|
||||
import types
|
||||
|
||||
# Trace function introduces __locals__ which causes various tests to fail.
|
||||
if hasattr(sys, 'gettrace') and sys.gettrace():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue