Commit ab05dfa5 authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

Revert "*: keep using func_code and not yet __code__ with scripts"

This reverts commit eaae74a0.

On Zope4 branch we are ready to use __code__
parent 6f417453
......@@ -164,7 +164,7 @@ class Alarm(XMLObject, PeriodicityMixin):
activate_kw['tag'] = '%s_%x' % (self.getRelativeUrl(), getrandbits(32))
tag = activate_kw['tag']
method = getattr(self, method_id)
func_code = method.func_code
func_code = method.__code__
try:
has_kw = func_code.co_flags & CO_VARKEYWORDS
except AttributeError:
......
......@@ -41,7 +41,7 @@ class Accessor(Method):
def __getinitargs__(self):
init = getattr(self, '__init__', None)
if init is not None:
varnames = init.func_code.co_varnames
varnames = init.__code__.co_varnames
args = []
for name in varnames:
if name == 'self':
......
......@@ -181,7 +181,7 @@ class Predicate(XMLObject):
try:
result = method(self)
except TypeError:
if method.func_code.co_argcount != isinstance(method, MethodType):
if method.__code__.co_argcount != isinstance(method, MethodType):
raise
# backward compatibilty with script that takes no argument
warn('Predicate %s uses an old-style method (%s) that does not'
......
......@@ -71,8 +71,8 @@ class InteractorMethod(Method):
self.after_action_list = []
self.before_action_list = []
self.method = method
self.__code__ = self.func_code = method.func_code
self.__defaults__ = self.func_defaults = method.func_defaults
self.__code__ = self.func_code = method.__code__
self.__defaults__ = self.func_defaults = method.__defaults__
self.__name__ = method.__name__
def registerBeforeAction(self, action, args, kw):
......
......@@ -234,7 +234,7 @@ def deprecated(message=''):
@simple_decorator
def _deprecated(wrapped):
m = message or "Use of '%s' function (%s, line %s) is deprecated." % (
wrapped.__name__, wrapped.__module__, wrapped.func_code.co_firstlineno)
wrapped.__name__, wrapped.__module__, wrapped.__code__.co_firstlineno)
def deprecated(*args, **kw):
warnings.warn(m, DeprecationWarning, 2)
return wrapped(*args, **kw)
......
......@@ -44,7 +44,7 @@ def volatileCached(self, func):
self._v_SimpleItem_Item_vCache = cache_dict = {}
# Use whole func_code as a key, as it is the only reliable way to identify a
# function.
key = func.func_code
key = func.__code__
try:
return cache_dict[key]
except KeyError:
......
......@@ -1451,7 +1451,7 @@ class Catalog(Folder,
if meta_type in self.HAS_ARGUMENT_SRC_METATYPE_SET:
return method.arguments_src.split()
elif meta_type in self.HAS_FUNC_CODE_METATYPE_SET:
return method.func_code.co_varnames[:method.func_code.co_argcount]
return method.__code__.co_varnames[:method.__code__.co_argcount]
# Note: Raising here would completely prevent indexation from working.
# Instead, let the method actually fail when called, so _catalogObjectList
# can log the error and carry on.
......@@ -1837,7 +1837,7 @@ class Catalog(Folder,
else:
search_key = self.getSearchKey(key, 'RelatedKey')
else:
func_code = script.func_code
func_code = script.__code__
search_key = (
AdvancedSearchKeyWrapperForScriptableKey if (
# 5: search_value (under any name), "search_key", "group",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment