pycdc icon indicating copy to clipboard operation
pycdc copied to clipboard

Python 3.0 "if" body range not detected properly

Open rocky opened this issue 5 years ago • 0 comments

Consider:

# From Python 3.0 _markupbase.py.
#
# The Problem was in the way "if"s are generated in 3.0 which is sort
# of like a more optimized Python 2.6, with reduced extraneous jumps,
# but still 2.6-ish and not 2.7- or 3.1-ish.
def parse_marked_section(fn, i, rawdata, report=1):
    if report:
        j = 1
        fn(rawdata[i: j])
    return 10

When compiled + decompiled pydc puts fn outside of the if, i.e:

def parse_marked_section(fn, i, rawdata, report = 1):
    if report:
        j = 1
    fn(rawdata[i:j])
    return 10

rocky avatar Nov 10 '19 23:11 rocky