Message46759
This patch implements decorator syntax J2 from
http://www.python.org/moin/PythonDecorators
Example:
class Foo:
decorate:
staticmethod deprecated memoize
author("Joe Bloggs")
def foo(bar):
pass
Key changes:
* Grammar/Grammar updated
* Python/compile.c updated.
* Test suite, docs and Lib updated. (test suite passes on my
linux box)
Specific changes:
* Grammar/Grammar changed to recognise J2 syntax
* Python/compile.c changed to support J2
* Removed "@" from Lib/tokenize.py as Special
* Removed "AT" from joe Include/token.h as a token
* Removed "AT" from Parser/tokenizer.c
* Doc/lib/libfuncs.tex - Changed examples from @ format
to decorate: format
* Doc/ref/ref7.tex
- changed Function Definitions production rules to match
the change in syntax.
- Changed example to use the change in syntax.
* Lib/compiler/transformer.py - Modified to handle the new
syntax
* Lib/test/test_parser.py - Changed tests for old syntax to
check new form
* Lib/test/tokenize_tests.txt - changed @staticmethod to J2
format
* Lib/test/output/test_tokenize - Changed to match the
changed test file
* Modules/parsermodule.c - Changed to support new
Grammar
* Lib/test/pyclbr_input.py - Changed from @ syntax to
decorate: syntax
* Lib/test/test_decorators.py - changed all "decorate"
functions to
decorate_ and all @ usages to "decorate:" syntax.
Files checked, but not changed:
* Doc/lib/asttable.tex - Can't see any necessary changes
* Lib/compiler/pycodegen.py - Can't see any necessary
changes
* Lib/compiler/symbols.py - Can't see any necessary
changes
* Tools/compiler/ast.txt - Can't see any necessary changes
* Tools/compiler/astgen.py - Can't see any necessary
changes
* Tools/compiler/regrtest.py - No changes
NB:
* I can't see whether ast.py should/should not be changed
and
if it should, *how* it should be changed, as a result I've left
well alone.
Issues:
* Keyword clash with test suite is bad - suggest change to
"using"
to limit clash with existing user code as far as possible.
I intend to follow this up with a replacement with a
changed keyword and if possible shortened/simplified
version.
* Patch is against the vanilla 2.4a2 download from
python.org, does
this need changing to being a patch against the current
CVS head?
(I suspect the answer to this is "yes")
* The following tests are skipped on my machine:
test_aepack test_al test_applesingle test_bsddb185
test_bsddb3
test_cd test_cl test_codecmaps_cn test_codecmaps_hk
test_codecmaps_jp test_codecmaps_kr
test_codecmaps_tw test_curses
test_gdbm test_gl test_imgfile test_largefile
test_linuxaudiodev
test_macfs test_macostools test_nis test_normalization
test_ossaudiodev test_pep277 test_plistlib
test_scriptpackages
test_socket_ssl test_socketserver test_sunaudiodev
test_tcl
test_timeout test_urllibnet test_winreg test_winsound
As a result I don't know for certain these aren't affected by
the
change. I'm checking them by hand at present.
|
|
Date |
User |
Action |
Args |
2007-08-23 15:39:31 | admin | link | issue1013835 messages |
2007-08-23 15:39:31 | admin | create | |
|