|
29 | 29 | from pathlib import Path
|
30 | 30 | from typing import TYPE_CHECKING, Any, Callable, ClassVar
|
31 | 31 |
|
32 |
| -import dill |
33 | 32 | import isort
|
34 | 33 | from rich.align import Align
|
35 | 34 | from rich.panel import Panel
|
|
41 | 40 | from codeflash.code_utils.code_utils import module_name_from_file_path
|
42 | 41 | from codeflash.code_utils.config_parser import parse_config_file
|
43 | 42 | from codeflash.discovery.functions_to_optimize import filter_files_optimized
|
| 43 | +from codeflash.picklepatch.pickle_patcher import PicklePatcher |
44 | 44 | from codeflash.tracing.replay_test import create_trace_replay_test
|
45 | 45 | from codeflash.tracing.tracing_utils import FunctionModules
|
46 | 46 | from codeflash.verification.verification_utils import get_test_file_path
|
@@ -399,22 +399,12 @@ def tracer_logic(self, frame: FrameType, event: str) -> None: # noqa: PLR0911
|
399 | 399 | arguments_copy = dict(arguments.items()) # Use the local 'arguments' from frame.f_locals
|
400 | 400 | if class_name and code.co_name == "__init__" and "self" in arguments_copy:
|
401 | 401 | del arguments_copy["self"]
|
402 |
| - local_vars = pickle.dumps(arguments_copy, protocol=pickle.HIGHEST_PROTOCOL) |
| 402 | + local_vars = PicklePatcher.dumps(arguments_copy, protocol=pickle.HIGHEST_PROTOCOL) |
403 | 403 | sys.setrecursionlimit(original_recursion_limit)
|
404 | 404 | except Exception:
|
405 |
| - # we retry with dill if pickle fails. It's slower but more comprehensive |
406 |
| - try: |
407 |
| - sys.setrecursionlimit(10000) # Ensure limit is high for dill too |
408 |
| - # arguments_copy should be used here as well if defined above |
409 |
| - local_vars = dill.dumps( |
410 |
| - arguments_copy if "arguments_copy" in locals() else dict(arguments.items()), |
411 |
| - protocol=dill.HIGHEST_PROTOCOL, |
412 |
| - ) |
413 |
| - sys.setrecursionlimit(original_recursion_limit) |
414 |
| - |
415 |
| - except Exception: |
416 |
| - self.function_count[function_qualified_name] -= 1 |
417 |
| - return |
| 405 | + self.function_count[function_qualified_name] -= 1 |
| 406 | + sys.setrecursionlimit(original_recursion_limit) |
| 407 | + return |
418 | 408 |
|
419 | 409 | cur.execute(
|
420 | 410 | "INSERT INTO function_calls VALUES(?, ?, ?, ?, ?, ?, ?, ?)",
|
|
0 commit comments