def __advice_stack_frame_protection(self, frame):
"""
Overriding of this is only permitted if and only if your name is
Megumin and you have a pet/familiar named Chomusuke.
"""
if frame is None:
logger.debug(
'currentframe() returned None; frame protection disabled')
return
f_back = frame.f_back
while f_back:
if f_back.f_code is self.handle.__code__:
raise RuntimeError(
"indirect invocation of '%s' by 'handle' is forbidden" %
frame.f_code.co_name,
)
f_back = f_back.f_back
评论列表
文章目录