[pypy-svn] r54526 - pypy/dist/pypy/objspace/std
arigo at codespeak.net
arigo at codespeak.net
Wed May 7 13:20:43 CEST 2008
Author: arigo
Date: Wed May 7 13:20:43 2008
New Revision: 54526
Modified:
pypy/dist/pypy/objspace/std/builtinshortcut.py
Log:
Add a few missing operations to builtinshortcut.
Add a table of "known missing" operations to make
sure this doesn't occur any more.
Modified: pypy/dist/pypy/objspace/std/builtinshortcut.py
==============================================================================
--- pypy/dist/pypy/objspace/std/builtinshortcut.py (original)
+++ pypy/dist/pypy/objspace/std/builtinshortcut.py Wed May 7 13:20:43 2008
@@ -21,6 +21,7 @@
# unary
'len', 'nonzero', 'repr', 'str', 'hash',
'neg', 'invert', 'index', 'iter', 'next', 'buffer',
+ 'getitem', 'setitem', 'int',
# in-place
'inplace_add', 'inplace_sub', 'inplace_mul', 'inplace_truediv',
'inplace_floordiv', 'inplace_div', 'inplace_mod', 'inplace_pow',
@@ -28,6 +29,20 @@
'inplace_xor',
])
+KNOWN_MISSING = ['getattr', # mostly non-builtins or optimized by CALL_METHOD
+ 'setattr', 'delattr', 'userdel', # mostly for non-builtins
+ 'get', 'set', 'delete', # uncommon (except on functions)
+ 'delitem', 'abs', 'hex', 'oct', # rare stuff?
+ 'pos', 'divmod', 'cmp', # rare stuff?
+ 'float', 'long', 'coerce', # rare stuff?
+ ]
+
+for _name, _, _, _specialmethods in ObjSpace.MethodTable:
+ if _specialmethods:
+ assert _name in METHODS_WITH_SHORTCUT or _name in KNOWN_MISSING, (
+ "operation %r should be in METHODS_WITH_SHORTCUT or KNOWN_MISSING"
+ % (_name,))
+
def install(space, mm):
"""Install a function <name>() on the space instance which invokes
More information about the Pypy-commit
mailing list