Skip to content

Commit 3bb0af2

Browse files
author
Sylvain MARIE
committed
Improved getfullargspec so as to cover more builtins in python 3
1 parent 5a476e0 commit 3bb0af2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

valid8/utils/signature_tools.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ def _signature_is_builtin(obj):
3838
# also be True for regular python classes
3939
obj in (type, object))
4040

41+
def _is_builtin_value_error(e):
42+
try:
43+
return (e.__class__ is ValueError) and ('builtin' in e.args[0])
44+
except:
45+
return False
46+
4147
def getfullargspec(f, skip_bound_arg=False, follow_wrapped=True):
4248
"""
4349
This method adds `skip_bound_arg` argument to `getfullargspec` so that it is capable of skipping the 'self'
@@ -61,6 +67,8 @@ def getfullargspec(f, skip_bound_arg=False, follow_wrapped=True):
6167
raise IsBuiltInError(f)
6268
elif isinstance(f, partial) and _signature_is_builtin(f.func):
6369
raise IsBuiltInError(f)
70+
elif _is_builtin_value_error(e):
71+
raise IsBuiltInError(f)
6472
else:
6573
raise
6674

0 commit comments

Comments
 (0)