Marc 'BlackJack' Rintsch
2017-02-22 10:32:26 UTC
Hi,
The stack effect of BUILD_CLASS is given as (3, 0) in the
`peak.util.assembler` module, but it is actually (3, 1) as it leaves the
newly built class object on the stack.
Currently I'm using this monkey patch in my code::
from peak.util.assembler import (
BUILD_CLASS as BUILD_CLASS_OPCODE, Code, stack_effects
)
if stack_effects[BUILD_CLASS_OPCODE] == (3, 0):
#
# Patch in BUILD_CLASS method with correct stack effect.
#
def BUILD_CLASS(self, op=BUILD_CLASS_OPCODE, se=(3, 1)):
self.stackchange(se); self.emit(op)
setattr(Code, 'BUILD_CLASS', BUILD_CLASS)
Ciao,
Marc 'BlackJack' Rintsch
The stack effect of BUILD_CLASS is given as (3, 0) in the
`peak.util.assembler` module, but it is actually (3, 1) as it leaves the
newly built class object on the stack.
Currently I'm using this monkey patch in my code::
from peak.util.assembler import (
BUILD_CLASS as BUILD_CLASS_OPCODE, Code, stack_effects
)
if stack_effects[BUILD_CLASS_OPCODE] == (3, 0):
#
# Patch in BUILD_CLASS method with correct stack effect.
#
def BUILD_CLASS(self, op=BUILD_CLASS_OPCODE, se=(3, 1)):
self.stackchange(se); self.emit(op)
setattr(Code, 'BUILD_CLASS', BUILD_CLASS)
Ciao,
Marc 'BlackJack' Rintsch
--
Calm down. It's only ones and zeros.
Calm down. It's only ones and zeros.