pyglove 0.4.5.dev202504200808__py3-none-any.whl → 0.4.5.dev202504220810__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyglove/core/coding/errors.py +2 -2
- pyglove/core/coding/execution.py +3 -3
- pyglove/core/coding/execution_test.py +4 -0
- {pyglove-0.4.5.dev202504200808.dist-info → pyglove-0.4.5.dev202504220810.dist-info}/METADATA +1 -1
- {pyglove-0.4.5.dev202504200808.dist-info → pyglove-0.4.5.dev202504220810.dist-info}/RECORD +8 -8
- {pyglove-0.4.5.dev202504200808.dist-info → pyglove-0.4.5.dev202504220810.dist-info}/WHEEL +1 -1
- {pyglove-0.4.5.dev202504200808.dist-info → pyglove-0.4.5.dev202504220810.dist-info}/licenses/LICENSE +0 -0
- {pyglove-0.4.5.dev202504200808.dist-info → pyglove-0.4.5.dev202504220810.dist-info}/top_level.txt +0 -0
pyglove/core/coding/errors.py
CHANGED
@@ -28,7 +28,7 @@ class CodeError(RuntimeError):
|
|
28
28
|
def __init__(
|
29
29
|
self,
|
30
30
|
code: str,
|
31
|
-
cause:
|
31
|
+
cause: BaseException,
|
32
32
|
):
|
33
33
|
self.code = code
|
34
34
|
self.cause = cause
|
@@ -93,7 +93,7 @@ class CodeError(RuntimeError):
|
|
93
93
|
class SerializationError(RuntimeError):
|
94
94
|
"""Object serialization error."""
|
95
95
|
|
96
|
-
def __init__(self, message: Optional[str], cause:
|
96
|
+
def __init__(self, message: Optional[str], cause: BaseException):
|
97
97
|
self.message = message
|
98
98
|
self.cause = cause
|
99
99
|
|
pyglove/core/coding/execution.py
CHANGED
@@ -131,7 +131,7 @@ def evaluate(
|
|
131
131
|
result = eval( # pylint: disable=eval-used
|
132
132
|
compile(last_expr, '', mode='eval'), global_vars
|
133
133
|
)
|
134
|
-
except
|
134
|
+
except BaseException as e:
|
135
135
|
raise errors.CodeError(code, e) from e
|
136
136
|
|
137
137
|
for result_var in result_vars:
|
@@ -139,7 +139,7 @@ def evaluate(
|
|
139
139
|
else:
|
140
140
|
try:
|
141
141
|
exec(compile(code_block, '', mode='exec'), global_vars) # pylint: disable=exec-used
|
142
|
-
except
|
142
|
+
except BaseException as e:
|
143
143
|
raise errors.CodeError(code, e) from e
|
144
144
|
global_vars[RESULT_KEY] = list(global_vars.values())[-1]
|
145
145
|
|
@@ -188,7 +188,7 @@ def sandbox_call(
|
|
188
188
|
r = func(*args, **kwargs)
|
189
189
|
try:
|
190
190
|
return pickle.dumps(r)
|
191
|
-
except
|
191
|
+
except BaseException as e:
|
192
192
|
raise errors.SerializationError(
|
193
193
|
f'Cannot serialize sandbox result: {r}', e
|
194
194
|
) from e
|
@@ -217,6 +217,10 @@ class EvaluateTest(unittest.TestCase):
|
|
217
217
|
execution.evaluate(
|
218
218
|
'raise ValueError()', permission=permissions.CodePermission.ALL
|
219
219
|
)
|
220
|
+
with self.assertRaisesRegex(errors.CodeError, 'SystemExit'):
|
221
|
+
execution.evaluate(
|
222
|
+
'raise SystemExit()', permission=permissions.CodePermission.ALL
|
223
|
+
)
|
220
224
|
|
221
225
|
|
222
226
|
@dataclasses.dataclass
|
@@ -3,10 +3,10 @@ pyglove/core/__init__.py,sha256=BF-8v1D5lTBAo4vlpDt0qyOG9NQ71oh_UfthBVrPaN4,9614
|
|
3
3
|
pyglove/core/logging.py,sha256=Sr5nLyUQmc4CAEYAq8qbP3ghpjmpz2sOuhq2A0tgQ6I,2456
|
4
4
|
pyglove/core/logging_test.py,sha256=3z_c6wnxbqDbwUmSOAZzeDPXvzoweYL5QHUQVMJ5Xgo,1917
|
5
5
|
pyglove/core/coding/__init__.py,sha256=tuHIg19ZchtkOQbdFVTVLkUpBa5f1eo66XtnKw3lcIU,1645
|
6
|
-
pyglove/core/coding/errors.py,sha256=
|
6
|
+
pyglove/core/coding/errors.py,sha256=aP3Y4amBzOKdlb5JnESJ3kdoijQXbiBiPDMeA88LNrk,3310
|
7
7
|
pyglove/core/coding/errors_test.py,sha256=fwOR8vLiRvLadubsccyE19hLHj-kThlCQt88qmUYk9M,2311
|
8
|
-
pyglove/core/coding/execution.py,sha256=
|
9
|
-
pyglove/core/coding/execution_test.py,sha256=
|
8
|
+
pyglove/core/coding/execution.py,sha256=KGKl4ovtAPYJI-eQTLBTMwqE4FXSLbTDCj5NI4kVmy4,10943
|
9
|
+
pyglove/core/coding/execution_test.py,sha256=7V6hwShKiqpLR8jZl1tFvV3qV8QW5ZcEtBZ1rSOFPrc,9111
|
10
10
|
pyglove/core/coding/function_generation.py,sha256=2fCqcdcizVYtGYE6QGpw5m1kuH9Fp0OF4BjyJ4en6tw,1636
|
11
11
|
pyglove/core/coding/function_generation_test.py,sha256=kbSwmZF8Vog0R0OTSpuzPblEbMLoRJ1TigeIrwDhHS8,2161
|
12
12
|
pyglove/core/coding/parsing.py,sha256=JXTdzFS9iB5-JVi9_-rDFORj_EZEtr7In8HBGHp09no,4084
|
@@ -212,8 +212,8 @@ pyglove/ext/scalars/randoms.py,sha256=LkMIIx7lOq_lvJvVS3BrgWGuWl7Pi91-lA-O8x_gZs
|
|
212
212
|
pyglove/ext/scalars/randoms_test.py,sha256=nEhiqarg8l_5EOucp59CYrpO2uKxS1pe0hmBdZUzRNM,2000
|
213
213
|
pyglove/ext/scalars/step_wise.py,sha256=IDw3tuTpv0KVh7AN44W43zqm1-E0HWPUlytWOQC9w3Y,3789
|
214
214
|
pyglove/ext/scalars/step_wise_test.py,sha256=TL1vJ19xVx2t5HKuyIzGoogF7N3Rm8YhLE6JF7i0iy8,2540
|
215
|
-
pyglove-0.4.5.
|
216
|
-
pyglove-0.4.5.
|
217
|
-
pyglove-0.4.5.
|
218
|
-
pyglove-0.4.5.
|
219
|
-
pyglove-0.4.5.
|
215
|
+
pyglove-0.4.5.dev202504220810.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
216
|
+
pyglove-0.4.5.dev202504220810.dist-info/METADATA,sha256=-Sj2NcVurblr6oRtg8MuQGrWR4BZUY3dx_hYoojtNuA,7089
|
217
|
+
pyglove-0.4.5.dev202504220810.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
218
|
+
pyglove-0.4.5.dev202504220810.dist-info/top_level.txt,sha256=wITzJSKcj8GZUkbq-MvUQnFadkiuAv_qv5qQMw0fIow,8
|
219
|
+
pyglove-0.4.5.dev202504220810.dist-info/RECORD,,
|
{pyglove-0.4.5.dev202504200808.dist-info → pyglove-0.4.5.dev202504220810.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{pyglove-0.4.5.dev202504200808.dist-info → pyglove-0.4.5.dev202504220810.dist-info}/top_level.txt
RENAMED
File without changes
|