[Patches] [ python-Patches-1681101 ] PEP 3115 patch
SourceForge.net
noreply at sourceforge.net
Fri Mar 16 21:07:16 CET 2007
Patches item #1681101, was opened at 2007-03-14 20:09
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1681101&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 3000
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Guido van Rossum (gvanrossum)
Summary: PEP 3115 patch
Initial Comment:
A patch for PEP 3115 (metaclass syntax for Py3k). This enables full [arglist] syntax in the class header, e.g.
class C(B1, B2, metaclass=MC, *more_bases, **kwds):
pass
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2007-03-16 16:07
Message:
Logged In: YES
user_id=6380
Originator: YES
Fixed two bugs, with the help of (improved) test_metaclass.py:
- bug in symtable handling of keyword args that triggered an assert in
debug mode
- bug in build_class that mutated the keyword args dict in place
I've got the feeling that there are leaks.
File Added: meta.patch
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2007-03-16 14:50
Message:
Logged In: YES
user_id=6380
Originator: YES
And another. This adds a unittest for the new build_class functionality,
and fixes one bug (in the way __prepare__ was called) found this way. BTW
doctest rocks for this purpose.
File Added: meta.patch
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2007-03-16 11:53
Message:
Logged In: YES
user_id=6380
Originator: YES
New patch, gets rid of LOAD_LOCALS and BUILD_CLASS opcodes and adds
LOAD_BUILD_CLASS opcode which avoids looking for __build_class__ in the
globals; it only searches the builtins (like the IMPORT statement). Though
this is debatable.
File Added: meta.patch
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2007-03-16 00:11
Message:
Logged In: YES
user_id=6380
Originator: YES
Here's a new version that implements __build_class__ in C. It's still an
ordinary built-in function loaded using LOAD_GLOBAL so you can play games
with this; however I'd rather keep that an implementation detail and not a
feature (unlike overriding __import__, which *is* a feature).
One thing that's missing is support for __metaclass__, either in the
module, or in the class. I don't want to support those (maybe the PEP
should mention this), but we need a fixer for 2to3 to warn about this, at
least (and to convert class C: __metaclass__ = M; ... into class
C(metaclass=M): ...).
BTW, the test_grp failure mentioned earlier is bogus; that's an artefact
of Google's LDAP. Some more tests probably fail, but I'll worry about
those later.
File Added: meta.patch
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2007-03-15 17:53
Message:
Logged In: YES
user_id=6380
Originator: YES
New version. Fixes problems with bsddb, removes dead declaration from
bltinmodule.c, and updates outdated docs for MAKE_FUNCTION and MAKE_CLOSURE
in opcode.h while I was at it.
File Added: meta.patch
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2007-03-15 17:06
Message:
Logged In: YES
user_id=6380
Originator: YES
Here's a new patch, which generates correct code for all variants of the
class header syntax.
For now, I've implemented __build_class__ in Python; the built-in function
by that name imports the build_class module and calls its build_class
function. (I'll later redo this in C.)
This is still rough; I didn't even delete the old BUILD_CLASS opcode. But
only a few unit tests fail (especially the ast and compiler tests). There
are no unit tests for the new functionality. There is no documentation.
Failing tests:
test_ast test_compiler test_ctypes test_descr test_grp test_pep292
File Added: meta.patch
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1681101&group_id=5470
More information about the Patches
mailing list