Changeset 947


Ignore:
Timestamp:
Jan 2, 2019, 1:52:51 PM (10 months ago)
Author:
cito
Message:

Fix bug in parsing subscript ranges.

This is GitHub? issue #10, reported by Justin Pryzby.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/pgmodule.c

    r932 r947  
    665665                        while (s != end && *s == ' ') ++s;
    666666                        if (s != end && (*s == '+' || *s == '-')) ++s;
    667                         if (s == end || *s <= '0' || *s >= '9') break;
     667                        if (s == end || *s < '0' || *s > '9') break;
    668668                        while (s != end && *s >= '0' && *s <= '9') ++s;
    669669                        if (s == end || *s++ != ':') break;
    670670                        if (s != end && (*s == '+' || *s == '-')) ++s;
    671                         if (s == end || *s <= '0' || *s >= '9') break;
     671                        if (s == end || *s < '0' || *s > '9') break;
    672672                        while (s != end && *s >= '0' && *s <= '9') ++s;
    673673                        if (s == end || *s++ != ']') break;
  • trunk/tests/test_classic_functions.py

    r822 r947  
    203203        ('[-3:-1]={1,2,3}', int, [1, 2, 3]),
    204204        ('[+1:+3]={1,2,3}', int, [1, 2, 3]),
     205        ('[0:2]={1,2,3}', int, [1, 2, 3]),
     206        ('[7:9]={1,2,3}', int, [1, 2, 3]),
    205207        ('[]={1,2,3}', int, ValueError),
    206208        ('[1:]={1,2,3}', int, ValueError),
Note: See TracChangeset for help on using the changeset viewer.