diff --git a/django/template/base.py b/django/template/base.py
index c5bddaf..fb6b309 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -690,7 +690,9 @@ class Variable(object):
         self.lookups = None
         self.translate = False
         self.message_context = None
-
+        if not isinstance(var, six.string_types):
+            raise TypeError(
+                "Variable must be a string or number, got %s" % type(var))
         try:
             # First try to treat this variable as a number.
             #
diff --git a/tests/template_tests/test_parser.py b/tests/template_tests/test_parser.py
index 9422da8..d5d8ec4 100644
--- a/tests/template_tests/test_parser.py
+++ b/tests/template_tests/test_parser.py
@@ -85,6 +85,8 @@ class ParserTests(TestCase):
         self.assertRaises(TemplateSyntaxError,
             Variable, "article._hidden"
         )
+        # Variables should raise on non string type
+        self.assertRaises(TypeError, Variable({}))
 
     @override_settings(DEBUG=True, TEMPLATE_DEBUG=True)
     def test_compile_filter_error(self):
