From c1f90d973d1132287d8f37da0084686b2af83d0e Mon Sep 17 00:00:00 2001 From: Mehrin Kiani Date: Wed, 1 Nov 2023 17:26:57 -0400 Subject: [PATCH] check *put instructions in pickle scan --- modelscan/tools/picklescanner.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modelscan/tools/picklescanner.py b/modelscan/tools/picklescanner.py index 18ae282..8a37296 100644 --- a/modelscan/tools/picklescanner.py +++ b/modelscan/tools/picklescanner.py @@ -133,7 +133,7 @@ def _list_globals( op_name = op[0].name op_value: str = op[1] - if op_name == "MEMOIZE" and n > 0: + if op_name in ["MEMOIZE", "PUT", "BINPUT", "LONG_BINPUT"] and n > 0: memo[len(memo)] = ops[n - 1][1] if op_name in ["GLOBAL", "INST"]: @@ -141,7 +141,12 @@ def _list_globals( elif op_name == "STACK_GLOBAL": values: List[str] = [] for offset in range(1, n): - if ops[n - offset][0].name == "MEMOIZE": + if ops[n - offset][0].name in [ + "MEMOIZE", + "PUT", + "BINPUT", + "LONG_BINPUT", + ]: continue if ops[n - offset][0].name in ["GET", "BINGET", "LONG_BINGET"]: values.append(memo[int(ops[n - offset][1])])