diff --git a/testslide/mock_callable.py b/testslide/mock_callable.py index e78aa482..743ab6e3 100644 --- a/testslide/mock_callable.py +++ b/testslide/mock_callable.py @@ -597,7 +597,12 @@ def _validate_patch( ) if ( coroutine_function - and not inspect.iscoroutinefunction(template_value) + and ( + # FIXME We cant reliably introspect coroutine functions + # for builtins: https://bugs.python.org/issue38225 + type(template_value) is not type(list.append) + and not inspect.iscoroutinefunction(template_value) + ) and not callable_returns_coroutine ): raise ValueError( @@ -640,7 +645,12 @@ def _validate_patch( ) if ( coroutine_function - and not inspect.iscoroutinefunction(original_callable) + and ( + # FIXME We cant reliably introspect coroutine functions + # for builtins: https://bugs.python.org/issue38225 + type(original_callable) is not type(list.append) + and not inspect.iscoroutinefunction(original_callable) + ) and not callable_returns_coroutine ): raise ValueError(