summaryrefslogtreecommitdiff
path: root/Lib/lib2to3/fixes/fix_reload.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-08-21 21:43:08 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2013-08-21 21:43:08 +0300
commitb7517ef372de8d3e7d2be2182962fe11f0a7ee60 (patch)
treef1fed2086be31a896d1ff47efda77c7f3b91353e /Lib/lib2to3/fixes/fix_reload.py
parentfdc29e85c4aa9a1d2964ec93b55f9d8e53be9fb2 (diff)
parentd1e599e1c9f6aa68e2974fb2746d5bb5b49f35e3 (diff)
downloadcpython-b7517ef372de8d3e7d2be2182962fe11f0a7ee60.tar.gz
Issue #17119: Fixed integer overflows when processing large strings and tuples
in the tkinter module.
Diffstat (limited to 'Lib/lib2to3/fixes/fix_reload.py')
-rw-r--r--Lib/lib2to3/fixes/fix_reload.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/lib2to3/fixes/fix_reload.py b/Lib/lib2to3/fixes/fix_reload.py
new file mode 100644
index 0000000000..1855357588
--- /dev/null
+++ b/Lib/lib2to3/fixes/fix_reload.py
@@ -0,0 +1,28 @@
+"""Fixer for reload().
+
+reload(s) -> imp.reload(s)"""
+
+# Local imports
+from .. import fixer_base
+from ..fixer_util import ImportAndCall, touch_import
+
+
+class FixReload(fixer_base.BaseFix):
+ BM_compatible = True
+ order = "pre"
+
+ PATTERN = """
+ power< 'reload'
+ trailer< lpar='('
+ ( not(arglist | argument<any '=' any>) obj=any
+ | obj=arglist<(not argument<any '=' any>) any ','> )
+ rpar=')' >
+ after=any*
+ >
+ """
+
+ def transform(self, node, results):
+ names = ('imp', 'reload')
+ new = ImportAndCall(node, results, names)
+ touch_import(None, 'imp', node)
+ return new