You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However some docstrings specifically formed might be incorrectly captured by this regex, which results in the call to finditer to hang indefinitely.
Here is a minimal example reproducing this issue:
classQuery(ImplicitDict):
participant_id: Optional[str]
"""If specified, identifier of the USS/participant hosting the server involved in this query."""defparse_json_result(self, parse_type: Type[ResponseType]) ->ResponseType:
"""Parses the JSON result into the specified type. Args: parse_type: ImplicitDict type to parse into. Returns: the parsed response (of type `parse_type`). Raises: QueryError: if the parsing failed. """try:
returnparse_type(ImplicitDict.parse(self.response.json, parse_type))
except (ValueError, TypeError, KeyError) ase:
raiseQueryError(
f"Parsing JSON response into type {parse_type.__name__} failed with exception {type(e).__name__}: {e}",
self,
)
classQueryError(RuntimeError):
"""Error encountered when interacting with a server in the UTM ecosystem."""queries: List[Query]
A workaround in the previous example would be to add e.g. a * before QueryError.
(initially reported here)
The
doc_pattern
regex is supposed (IIUC) to capture the docstrings of the class attributes:implicitdict/src/implicitdict/jsonschema.py
Line 200 in a137d9e
However some docstrings specifically formed might be incorrectly captured by this regex, which results in the call to
finditer
to hang indefinitely.Here is a minimal example reproducing this issue:
A workaround in the previous example would be to add e.g. a
*
beforeQueryError
.This issue can be easily highlighted using e.g. https://regex101.com and:
participant_id
is correctly caught, whileQueryError
is incorrectly caught as a class attribute with a docstringThe text was updated successfully, but these errors were encountered: