[Python-checkins] cpython (merge 3.5 -> default): Merge with 3.5

terry.reedy python-checkins at python.org
Wed Sep 9 08:11:47 CEST 2015


https://hg.python.org/cpython/rev/b4a7600d4314
changeset:   97800:b4a7600d4314
parent:      97796:08783af6e9a7
parent:      97799:c27490d2372c
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Wed Sep 09 02:10:47 2015 -0400
summary:
  Merge with 3.5

files:
  Lib/idlelib/idle_test/test_warning.py |   9 +++++++++
  Lib/idlelib/idlever.py                |  12 ++++++++++--
  2 files changed, 19 insertions(+), 2 deletions(-)


diff --git a/Lib/idlelib/idle_test/test_warning.py b/Lib/idlelib/idle_test/test_warning.py
--- a/Lib/idlelib/idle_test/test_warning.py
+++ b/Lib/idlelib/idle_test/test_warning.py
@@ -68,6 +68,15 @@
                     'Test', UserWarning, 'test_warning.py', 99, f, 'Line of code')
             self.assertEqual(shellmsg.splitlines(), f.getvalue().splitlines())
 
+class ImportWarnTest(unittest.TestCase):
+    def test_idlever(self):
+        with warnings.catch_warnings(record=True) as w:
+            warnings.simplefilter("always")
+            import idlelib.idlever
+            self.assertEqual(len(w), 1)
+            self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
+            self.assertIn("version", str(w[-1].message))
+
 
 if __name__ == '__main__':
     unittest.main(verbosity=2, exit=False)
diff --git a/Lib/idlelib/idlever.py b/Lib/idlelib/idlever.py
--- a/Lib/idlelib/idlever.py
+++ b/Lib/idlelib/idlever.py
@@ -1,4 +1,12 @@
-"""Unused by Idle: there is no separate Idle version anymore.
-Kept only for possible existing extension use."""
+"""
+The separate Idle version was eliminated years ago;
+idlelib.idlever is no longer used by Idle
+and will be removed in 3.6 or later.  Use
+    from sys import version
+    IDLE_VERSION = version[:version.index(' ')]
+"""
+# Kept for now only for possible existing extension use
+import warnings as w
+w.warn(__doc__, DeprecationWarning)
 from sys import version
 IDLE_VERSION = version[:version.index(' ')]

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list