Skip to content

Commit 1e1c2c8

Browse files
committed
_unwrap_restricted_proxy helper
1 parent aae176e commit 1e1c2c8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

temporalio/worker/workflow_sandbox/_restrictions.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,13 +950,20 @@ def _is_restrictable(v: Any) -> bool:
950950
)
951951

952952

953+
def _unwrap_restricted_proxy(v: Any) -> Any:
954+
# TODO: __wrapped__ should do this but it's broken.
955+
if isinstance(v, _RestrictedProxy):
956+
return object.__getattribute__(v, "__temporal_state").obj
957+
return v
958+
959+
953960
class _RestrictedProxy:
954961
@classmethod
955962
def __get_pydantic_core_schema__(
956963
cls, source_type: Any, handler: GetCoreSchemaHandler
957964
) -> CoreSchema:
958965
return core_schema.no_info_after_validator_function(
959-
cls, handler(object.__getattribute__(source_type, "__temporal_state").obj)
966+
cls, handler(_unwrap_restricted_proxy(source_type))
960967
)
961968

962969
def __init__(self, *args, **kwargs) -> None:

0 commit comments

Comments
 (0)