From 9f99f25db5f6a65d79324692728dc9db4e3a9525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Sat, 25 Jun 2016 12:21:54 +0200 Subject: [PATCH] linter: Assert that `_run()` is called with a buffer --- yamllint/linter.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yamllint/linter.py b/yamllint/linter.py index 8af85a5..b8fb9e9 100644 --- a/yamllint/linter.py +++ b/yamllint/linter.py @@ -94,6 +94,9 @@ def get_syntax_error(buffer): def _run(buffer, conf): + assert hasattr(buffer, '__getitem__'), \ + '_run() argument must be a buffer, not a stream' + # If the document contains a syntax error, save it and yield it at the # right line syntax_error = get_syntax_error(buffer)