Commit 1778490
fix: Fix unsafe_local_code_executor for import scope
Merge google#869
How to reproduce the error:
```
from google.adk.code_executors import UnsafeLocalCodeExecutor
from google.adk.code_executors.code_execution_utils import CodeExecutionInput
result = UnsafeLocalCodeExecutor().execute_code(
invocation_context=None,
code_execution_input=CodeExecutionInput(
code='''
import math
def pi():
return math.pi
print(pi())
'''
)
)
print(result)
```
output:
```
CodeExecutionResult(stdout='', stderr="name 'math' is not defined", output_files=[])
```
COPYBARA_INTEGRATE_REVIEW=google#869 from qieqieplus:main 63f557b
PiperOrigin-RevId: 7871451891 parent a858d79 commit 1778490
1 file changed
Lines changed: 1 addition & 2 deletions
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
| 71 | + | |
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
| |||
0 commit comments