mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-28 09:28:48 +00:00
Catch System Error in ast parse (#20961)
I can't seem to reproduce, but i got this: ``` SystemError: AST constructor recursion depth mismatch (before=102, after=37) ``` And the operation isn't critical for the actual forward pass so seems preferable to expand our caught exceptions
This commit is contained in:
parent
2aca7fcdcf
commit
9fa9f05e5d
@ -218,7 +218,7 @@ def get_function_first_arg_dict_keys(func: Callable) -> Optional[List[str]]:
|
|||||||
visitor = IsFunctionArgDict()
|
visitor = IsFunctionArgDict()
|
||||||
visitor.visit(tree)
|
visitor.visit(tree)
|
||||||
return list(visitor.keys) if visitor.keys else None
|
return list(visitor.keys) if visitor.keys else None
|
||||||
except (SyntaxError, TypeError, OSError):
|
except (SyntaxError, TypeError, OSError, SystemError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ def get_lambda_source(func: Callable) -> Optional[str]:
|
|||||||
visitor = GetLambdaSource()
|
visitor = GetLambdaSource()
|
||||||
visitor.visit(tree)
|
visitor.visit(tree)
|
||||||
return visitor.source if visitor.count == 1 else name
|
return visitor.source if visitor.count == 1 else name
|
||||||
except (SyntaxError, TypeError, OSError):
|
except (SyntaxError, TypeError, OSError, SystemError):
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ def get_function_nonlocals(func: Callable) -> List[Any]:
|
|||||||
else:
|
else:
|
||||||
values.append(vv)
|
values.append(vv)
|
||||||
return values
|
return values
|
||||||
except (SyntaxError, TypeError, OSError):
|
except (SyntaxError, TypeError, OSError, SystemError):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user