-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatic detection of deprecated Python 2 forms of print and exec
Note: if those are handled, you can't use --safe because this check is using Python 3.6+ builtin AST. Fixes #49
- Loading branch information
Showing
7 changed files
with
98 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python2 | ||
|
||
import sys | ||
|
||
print >> sys.stderr , "Warning:" , | ||
print >> sys.stderr , "this is a blast from the past." | ||
print >> sys.stderr , "Look, a repr:", `sys` | ||
|
||
|
||
def function((_globals, _locals)): | ||
exec "print 'hi from exec!'" in _globals, _locals | ||
|
||
|
||
function((globals(), locals())) | ||
|
||
|
||
# output | ||
|
||
|
||
#!/usr/bin/env python2 | ||
|
||
import sys | ||
|
||
print >>sys.stderr, "Warning:", | ||
print >>sys.stderr, "this is a blast from the past." | ||
print >>sys.stderr, "Look, a repr:", ` sys ` | ||
|
||
|
||
def function((_globals, _locals)): | ||
exec "print 'hi from exec!'" in _globals, _locals | ||
|
||
|
||
function((globals(), locals())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters