diff --git a/jinja2_highlight/highlight.py b/jinja2_highlight/highlight.py
index <HASH>..<HASH> 100644
--- a/jinja2_highlight/highlight.py
+++ b/jinja2_highlight/highlight.py
@@ -26,7 +26,7 @@ class HighlightExtension(Extension):
     tags = set(['highlight'])
 
     def parse(self, parser):
-        lineno = parser.stream.next().lineno
+        lineno = next(parser.stream).lineno
 
         # TODO:
         # add support to show line numbers
Use the buildint next() function. Closes #3.