Skip to content

Commit

Permalink
Scripts/Signature: keep setting func_code and func_defaults (#1045)
Browse files Browse the repository at this point in the history
`_setFuncSignature` was accidentally setting `__code__` and
`__defaults__` twice.

On Zope 4 it should also support the old python 2 names `func_code`
and `func_defaults`, because Zope 4 supports python 2

Fixes zopefoundation/Products.PythonScripts#55
  • Loading branch information
perrinjerome committed May 23, 2022
1 parent f4bfc0b commit 2c991f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Shared/DC/Scripts/Signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _setFuncSignature(self, defaults=None, varnames=(), argcount=-1):
argcount = len(varnames)
# Generate a change only if we have to.
if self.__defaults__ != defaults:
self.__defaults__ = self.__defaults__ = defaults
self.__defaults__ = self.func_defaults = defaults
code = FuncCode(varnames, argcount)
if self.__code__ != code:
self.__code__ = self.__code__ = code
self.__code__ = self.func_code = code

0 comments on commit 2c991f5

Please sign in to comment.