Skip to content
Unverified Commit 0753d995 authored by Richard Si's avatar Richard Si Committed by GitHub
Browse files

Improve Python 2 only syntax detection (GH-2592)



* Improve Python 2 only syntax detection

First of all this fixes a mistake I made in Python 2 deprecation PR
using token.* to check for print/exec statements. Turns out that
for nodes with a type value higher than 256 its numeric type isn't
guaranteed to be constant. Using syms.* instead fixes this.

Also add support for the following cases:

    print "hello, world!"

    exec "print('hello, world!')"

    def set_position((x, y), value):
        pass

    try:
        pass
    except Exception, err:
        pass

    raise RuntimeError, "I feel like crashing today :p"

    `wow_these_really_did_exist`

    10L

* Add octal support, more test cases, and fixup long ints

Co-authored-by: default avatarJelle Zijlstra <jelle.zijlstra@gmail.com>

Co-authored-by: default avatarJelle Zijlstra <jelle.zijlstra@gmail.com>
parent f297c464
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment