[ python-Bugs-1019048 ] __metaclass__ in locals is ignored

SourceForge.net noreply at sourceforge.net
Mon Aug 30 14:52:28 CEST 2004


Bugs item #1019048, was opened at 2004-08-30 07:52
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1019048&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jeff Epler (jepler)
Assigned to: Nobody/Anonymous (nobody)
Summary: __metaclass__ in locals is ignored

Initial Comment:
The local namespace is not checked for a __metaclass__
when constructing a new class.  This may be consistent
with a strict reading of the language standard
[http://docs.python.org/ref/metaclasses.html#l2h-216]
but it's surprising.

I think that the lookup for __metaclass__ should
proceed in the same way as any other name lookup (after
it is not found in the namespace of the class-to-be),
which would include a lookup in the local namespace.

The attached file should print "metaclass called with
..." and "C constructed as None..." but it doesn't in
the "local case"

If this behavior is not a bug, would a doc patch
emphasizing the non-lookup in locals be accepted?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1019048&group_id=5470


More information about the Python-bugs-list mailing list