• Tim Peters's avatar
    _compile(): raise an exception if downcasting to SRE_CODE · 3d563509
    Tim Peters yazdı
    loses information:
    
        OverflowError: regular expression code size limit exceeded
    
    Otherwise the compiled code is gibberish, possibly leading at
    least to wrong results or (as reported on c.l.py) internal
    sre errors at match time.
    
    I'm not sure how to test this.  SRE_CODE is a 2-byte type on
    my box, and it's easy to create a regexp that causes the new
    exception to trigger here.  But it may be a 4-byte type on
    other boxes, and creating a regexp large enough to trigger
    problems there would be pretty crazy.
    
    Bugfix candidate.
    3d563509
_sre.c 96.1 KB