[pypy-svn] r73452 - pypy/branch/cpython-extension/pypy/module/cpyext
xoraxax at codespeak.net
xoraxax at codespeak.net
Tue Apr 6 15:53:50 CEST 2010
Author: xoraxax
Date: Tue Apr 6 15:53:49 2010
New Revision: 73452
Modified:
pypy/branch/cpython-extension/pypy/module/cpyext/api.py
Log:
If a name is given, create a func_with_new_name of the func in decorate().
Modified: pypy/branch/cpython-extension/pypy/module/cpyext/api.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/api.py (original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/api.py Tue Apr 6 15:53:49 2010
@@ -25,6 +25,7 @@
from pypy.module.exceptions import interp_exceptions
# CPython 2.4 compatibility
from py.builtin import BaseException
+from pypy.tool.sourcetools import func_with_new_name
DEBUG_WRAPPER = False
@@ -132,12 +133,13 @@
error = rffi.cast(restype, error)
def decorate(func):
- api_function = ApiFunction(argtypes, restype, func, borrowed, error)
- func.api_func = api_function
if name is None:
func_name = func.func_name
else:
func_name = name
+ func = func_with_new_name(func, name)
+ api_function = ApiFunction(argtypes, restype, func, borrowed, error)
+ func.api_func = api_function
if error is _NOT_SPECIFIED:
raise ValueError("function %s has no return value for exceptions"
More information about the Pypy-commit
mailing list