]> git.madduck.net Git - etc/vim.git/commit

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Improve Python 2 only syntax detection (GH-2592)
authorRichard Si <63936253+ichard26@users.noreply.github.com>
Fri, 12 Nov 2021 01:28:48 +0000 (20:28 -0500)
committerGitHub <noreply@github.com>
Fri, 12 Nov 2021 01:28:48 +0000 (20:28 -0500)
commit0753d99519b0c90f0f9f280b73783b537900dc16
tree64f762b71f91c124784f19a5401472ab865f9b80
parentf297c4644ee561ceadfb0bf3a08a89ac92b5a2ee
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: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
CHANGES.md
src/black/__init__.py
src/black/mode.py
src/blib2to3/pgen2/token.py
tests/data/python2_detection.py [new file with mode: 0644]
tests/test_black.py