]> granicus.if.org Git - python/commitdiff
bpo-30722: Make redemo work with Python 3.6+ (GH-2311)
authorChristoph Sarnowski <pixelbrei@gmail.com>
Mon, 23 Oct 2017 17:10:48 +0000 (19:10 +0200)
committerBerker Peksag <berker.peksag@gmail.com>
Mon, 23 Oct 2017 17:10:48 +0000 (20:10 +0300)
Misc/NEWS.d/next/Tools-Demos/2017-10-23-19-45-52.bpo-30722.ioRlAu.rst [new file with mode: 0644]
Tools/demo/redemo.py

diff --git a/Misc/NEWS.d/next/Tools-Demos/2017-10-23-19-45-52.bpo-30722.ioRlAu.rst b/Misc/NEWS.d/next/Tools-Demos/2017-10-23-19-45-52.bpo-30722.ioRlAu.rst
new file mode 100644 (file)
index 0000000..2d20c4b
--- /dev/null
@@ -0,0 +1,9 @@
+Make redemo work with Python 3.6 and newer versions.
+
+In Python 3.6, flags like re.DOTALL became members of an enum.IntFlag so
+usages like ``getattr(re, 'DOTALL')`` are invalid.
+
+Also, remove the ``LOCALE`` option since it doesn't work with string
+patterns in Python 3.
+
+Patch by Christoph Sarnowski.
index 8335d4c87204e58cf9f868340f86c96ef1e9c66d..256a63e0a00d4e5db491b3efb1c3eeb8aeadb9c6 100755 (executable)
@@ -75,7 +75,6 @@ class ReDemo:
         self.boxes = []
         self.vars = []
         for name in ('IGNORECASE',
-                     'LOCALE',
                      'MULTILINE',
                      'DOTALL',
                      'VERBOSE'):
@@ -83,7 +82,7 @@ class ReDemo:
                 frame = Frame(self.master)
                 frame.pack(fill=X)
                 self.frames.append(frame)
-            val = getattr(re, name)
+            val = getattr(re, name).value
             var = IntVar()
             box = Checkbutton(frame,
                     variable=var, text=name,