From a206ec15a0f6dbea10bf78fbc50e0bf64e3fb28f 2014-11-07 02:06:24 From: Carlos Cordoba Date: 2014-11-07 02:06:24 Subject: [PATCH] Update pygments monkeypatch for compatibility with Pygments 2.0 Closes gh-6877 --- diff --git a/IPython/qt/console/pygments_highlighter.py b/IPython/qt/console/pygments_highlighter.py index 4044be7..402938f 100644 --- a/IPython/qt/console/pygments_highlighter.py +++ b/IPython/qt/console/pygments_highlighter.py @@ -24,11 +24,12 @@ def get_tokens_unprocessed(self, text, stack=('root',)): for rexmatch, action, new_state in statetokens: m = rexmatch(text, pos) if m: - if type(action) is _TokenType: - yield pos, action, m.group() - else: - for item in action(self, m): - yield item + if action is not None: + if type(action) is _TokenType: + yield pos, action, m.group() + else: + for item in action(self, m): + yield item pos = m.end() if new_state is not None: # state transition