Skip to content

re doesn't work with big charsets #63526

Closed

Description

@serhiy-storchaka
BPO 19327
Nosy @vstinner, @ezio-melotti, @serhiy-storchaka
Files
  • re_bigcharset.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2013-10-24.19:25:42.727>
    created_at = <Date 2013-10-21.11:24:02.792>
    labels = ['expert-regex', 'type-bug', 'library']
    title = "re doesn't work with big charsets"
    updated_at = <Date 2013-10-24.19:25:42.726>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2013-10-24.19:25:42.726>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2013-10-24.19:25:42.727>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)', 'Regular Expressions']
    creation = <Date 2013-10-21.11:24:02.792>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['32277']
    hgrepos = []
    issue_num = 19327
    keywords = ['patch']
    message_count = 4.0
    messages = ['200747', '200748', '200751', '201163']
    nosy_count = 5.0
    nosy_names = ['vstinner', 'ezio.melotti', 'mrabarnett', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue19327'
    versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']

    Activity

    1. serhiy-storchaka commented on Oct 21, 2013

      @serhiy-storchaka
      MemberAuthor
      >>> import re
      >>> re.compile('[%s]' % ''.join(map(chr, range(256, 2**16, 255))))
      Traceback (most recent call last):
        File "/home/serhiy/py/cpython/Lib/sre_compile.py", line 211, in _optimize_charset
          charmap[fixup(av)] = 1
      IndexError: list assignment index out of range
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/home/serhiy/py/cpython/Lib/re.py", line 213, in compile
          return _compile(pattern, flags)
        File "/home/serhiy/py/cpython/Lib/re.py", line 280, in _compile
          p = sre_compile.compile(pattern, flags)
        File "/home/serhiy/py/cpython/Lib/sre_compile.py", line 489, in compile
          code = _code(p, flags)
        File "/home/serhiy/py/cpython/Lib/sre_compile.py", line 471, in _code
          _compile_info(code, p, flags)
        File "/home/serhiy/py/cpython/Lib/sre_compile.py", line 459, in _compile_info
          _compile_charset(charset, flags, code)
        File "/home/serhiy/py/cpython/Lib/sre_compile.py", line 177, in _compile_charset
          for op, av in _optimize_charset(charset, fixup):
        File "/home/serhiy/py/cpython/Lib/sre_compile.py", line 220, in _optimize_charset
          return _optimize_unicode(charset, fixup)
        File "/home/serhiy/py/cpython/Lib/sre_compile.py", line 342, in _optimize_unicode
          mapping = array.array('b', mapping).tobytes()
      OverflowError: signed char is greater than maximum
    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Oct 21, 2013
    3. vstinner commented on Oct 21, 2013

      @vstinner
      Member

      @serhiy: Could you please take a look at issue bpo-13100?

    4. serhiy-storchaka commented on Oct 21, 2013

      @serhiy-storchaka
      MemberAuthor

      I have encountered this bug when writing test for for fragment of my large patch which cleanups and optimize the re module (it is too large to be committed all at once).

    5. python-dev commented on Oct 24, 2013

      python-devmannequin
      Mannequin

      New changeset d2bb0da45c93 by Serhiy Storchaka in branch '2.7':
      Issue bpo-19327: Fixed the working of regular expressions with too big charset.
      http://hg.python.org/cpython/rev/d2bb0da45c93

      New changeset 4431fa917f22 by Serhiy Storchaka in branch '3.3':
      Issue bpo-19327: Fixed the working of regular expressions with too big charset.
      http://hg.python.org/cpython/rev/4431fa917f22

      New changeset 10081a0ca4bd by Serhiy Storchaka in branch 'default':
      Issue bpo-19327: Fixed the working of regular expressions with too big charset.
      http://hg.python.org/cpython/rev/10081a0ca4bd

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-regextype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions