diff --git a/django/template/base.py b/django/template/base.py
index dc6b0c3..ba2694b 100644
|
a
|
b
|
class Variable(object):
|
| 690 | 690 | self.lookups = None |
| 691 | 691 | self.translate = False |
| 692 | 692 | self.message_context = None |
| 693 | | |
| | 693 | if not isinstance(var, six.string_types): |
| | 694 | raise TypeError( |
| | 695 | "Variable must be a string or number, got %s" % type(var)) |
| 694 | 696 | try: |
| 695 | 697 | # First try to treat this variable as a number. |
| 696 | 698 | # |
diff --git a/tests/template_tests/test_parser.py b/tests/template_tests/test_parser.py
index 9422da8..60454df 100644
|
a
|
b
|
class ParserTests(TestCase):
|
| 86 | 86 | Variable, "article._hidden" |
| 87 | 87 | ) |
| 88 | 88 | |
| | 89 | # Variables should raise on non string type |
| | 90 | self.assertRaises(TypeError, |
| | 91 | Variable, {} |
| | 92 | ) |
| | 93 | |
| 89 | 94 | @override_settings(DEBUG=True, TEMPLATE_DEBUG=True) |
| 90 | 95 | def test_compile_filter_error(self): |
| 91 | 96 | # regression test for #19819 |