Skip to content

Commit

Permalink
Make args optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Boyan-MILANOV committed Dec 26, 2023
1 parent fee25b6 commit 0bc461b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fickling/fickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def insert_magic_int(self, magic: int, index: int = -1):
def insert_function_call_on_unpickled_object(
self,
function_definition: str,
constant_args: List[Any],
constant_args: Optional[List[Any]] = None,
):
"""Insert and call a function that takes the unpickled object as parameter.
Expand Down Expand Up @@ -554,8 +554,9 @@ def insert_function_call_on_unpickled_object(
self.insert(-1, Get.create(2))

# Add constant arguments
for arg in constant_args:
self.insert(-1, ConstantOpcode.new(arg))
if constant_args:
for arg in constant_args:
self.insert(-1, ConstantOpcode.new(arg))

# Now the stack contains [func, mark, model].
# We need to add TUPLE which
Expand Down

0 comments on commit 0bc461b

Please sign in to comment.