[Patches] [ python-Patches-979728 ] mplementation for PEP 318 using
java-style syntax
SourceForge.net
noreply at sourceforge.net
Mon Jul 26 15:58:43 CEST 2004
Patches item #979728, was opened at 2004-06-25 23:26
Message generated for change (Comment added) made by anthonybaxter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=979728&group_id=5470
Category: Parser/Compiler
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Mark Russell (mark_t_russell)
Assigned to: Nobody/Anonymous (nobody)
Summary: mplementation for PEP 318 using java-style syntax
Initial Comment:
This implements function decorators using the
Java-style syntax described in
http://mail.python.org/pipermail/python-dev/2004-June/045516.html
As the patch changes the grammar, you'll need to
make sure Include/graminit.h and Python/graminit.c
are writable after applying the patch but before
compiling (after a standard CVS checkout they are
read-only, which stops pgen from working).
Changes:
- adding @ as a token
- changing the grammer for funcdef
- adding com_decorator in compile.c
- adding test_decorator.py (based on Guido's version)
----------------------------------------------------------------------
>Comment By: Anthony Baxter (anthonybaxter)
Date: 2004-07-26 23:58
Message:
Logged In: YES
user_id=29957
I still get a failure in test_transformer after a make
distclean and rebuild and make distclean and rebuild.
FAILED (errors=1)
Traceback (most recent call last):
File "Lib/test/test_transformer.py", line 37, in ?
test_main()
File "Lib/test/test_transformer.py", line 32, in test_main
test_support.run_unittest(
File
"/home/anthony/src/py/pyhead/dist/src/Lib/test/test_support.py",
line 290, in run_unittest
run_suite(suite, testclass)
File
"/home/anthony/src/py/pyhead/dist/src/Lib/test/test_support.py",
line 275, in run_suite
raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent call last):
File "Lib/test/test_transformer.py", line 16, in
testMultipleLHS
a = transformer.parse(s)
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 50, in parse
return Transformer().parsesuite(buf)
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 120, in parsesuite
return self.transform(parser.suite(text))
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 113, in transform
return self.compile_node(tree)
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 149, in compile_node
return self.file_input(node[1:])
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 180, in file_input
self.com_append_stmt(stmts, node)
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 1025, in com_append_stmt
result = self.com_node(node)
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 768, in com_node
return self._dispatch[node[0]](node[1:])
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 252, in stmt
return self.com_stmt(nodelist[0])
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 1018, in com_stmt
result = self.lookup_node(node)(node[1:])
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 312, in expr_stmt
lval = self.com_augassign(nodelist[0])
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 922, in com_augassign
l = self.com_node(node)
File
"/home/anthony/src/py/pyhead/dist/src/Lib/compiler/transformer.py",
line 768, in com_node
return self._dispatch[node[0]](node[1:])
KeyError: 268
----------------------------------------------------------------------
Comment By: Anthony Baxter (anthonybaxter)
Date: 2004-07-26 23:41
Message:
Logged In: YES
user_id=29957
Hm. Pilot error on my part. I had to build once to get
graminit.h and graminit.c rebuilt, then rebuild again (after
nuking all .o files) to get it to work properly. *sigh*
----------------------------------------------------------------------
Comment By: Anthony Baxter (anthonybaxter)
Date: 2004-07-26 23:30
Message:
Logged In: YES
user_id=29957
After applying this patch, any attempts to use the
newly-built python (I deleted graminit.c and graminit.h, to
make sure they were rebuilt) gives the following on any
'import':
*-s*) CC='gcc -pthread' LDSHARED='gcc -pthread -shared'
OPT='-DNDEBUG -g -O3 -Wall -Wstrict-prototypes' ./python -E
./setup.py -q build;; *) CC='gcc -pthread' LDSHARED='gcc -pthread -shared'
OPT='-DNDEBUG -g -O3 -Wall -Wstrict-prototypes' ./python -E
./setup.py build;; esac
Traceback (most recent call last):
File "./setup.py", line 6, in ?
import sys, os, getopt, imp, re
SystemError: compile_node: unexpected node type
make: *** [sharedmods] Error 1
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=979728&group_id=5470
More information about the Patches
mailing list