[Eric] [PATCH] SubStyledLexer: fix the case when there are no substyles

termimd at yandex.com termimd at yandex.com
Thu Jun 27 03:17:56 BST 2019


# HG changeset patch
# User Mikhail Terekhov
# Date 1561514653 14400
#      Tue Jun 25 22:04:13 2019 -0400
# Node ID 2617d0d9bc02b5ef4d285ccafeef56b011fba2ca
# Parent  73cb6384a71f51d577cfaf8893ea2acec902aea5
SubStyledLexer: fix the case when there are no substyles.

Opening C/C++ files causes the OverflowError exception:
--------------------------------------------------------------------------------
<class 'OverflowError'>:
argument 2 overflowed: value must be in the range 0 to 18446744073709551615
--------------------------------------------------------------------------------
  ...
    self.lexer_.readSubstyles(self)
  File "/.../lib64/python3.5/site-packages/eric6/QScintilla/Lexers/SubstyledLexer.py", line 196, in readSubstyles
    subStyle["Words"].encode())
--------------------------------------------------------------------------------

diff --git a/eric6/QScintilla/Lexers/SubstyledLexer.py b/eric6/QScintilla/Lexers/SubstyledLexer.py
--- a/eric6/QScintilla/Lexers/SubstyledLexer.py
+++ b/eric6/QScintilla/Lexers/SubstyledLexer.py
@@ -184,6 +184,7 @@
                     editor.SCI_ALLOCATESUBSTYLES, baseStyleNo, subStyleLength)
                 if subStyleStart < 0:
                     subStyleLength = 0
+                    continue
                 subStyleIndex = -1
                 for subStyleKey in sorted(subStylesData.keys()):
                     subStyleIndex += 1


More information about the Eric mailing list