[Python-checkins] r62917 - in python/trunk: Doc/library/new.rst Lib/new.py Lib/test/test_new.py Lib/test/test_py3kwarn.py Misc/NEWS

brett.cannon python-checkins at python.org
Fri May 9 07:18:40 CEST 2008


Author: brett.cannon
Date: Fri May  9 07:18:40 2008
New Revision: 62917

Log:
Deprecate the new module for removal in 3.0.


Modified:
   python/trunk/Doc/library/new.rst
   python/trunk/Lib/new.py
   python/trunk/Lib/test/test_new.py
   python/trunk/Lib/test/test_py3kwarn.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Doc/library/new.rst
==============================================================================
--- python/trunk/Doc/library/new.rst	(original)
+++ python/trunk/Doc/library/new.rst	Fri May  9 07:18:40 2008
@@ -4,6 +4,10 @@
 
 .. module:: new
    :synopsis: Interface to the creation of runtime implementation objects.
+   :deprecated:
+
+.. deprecated:: The new module has been removed in Python 3.0.
+
 .. sectionauthor:: Moshe Zadka <moshez at zadka.site.co.il>
 
 

Modified: python/trunk/Lib/new.py
==============================================================================
--- python/trunk/Lib/new.py	(original)
+++ python/trunk/Lib/new.py	Fri May  9 07:18:40 2008
@@ -3,9 +3,10 @@
 This module is no longer required except for backward compatibility.
 Objects of most types can now be created by calling the type object.
 """
-from warnings import warnpy3k as _warnpy3k
-_warnpy3k("The 'new' module is not supported in 3.x, use the 'types' module "
-    "instead.", stacklevel=2)
+from warnings import warnpy3k
+warnpy3k("The 'new' module has been removed in Python 3.0; use the 'types' "
+            "module instead.", stacklevel=2)
+del warnpy3k
 
 from types import ClassType as classobj
 from types import FunctionType as function

Modified: python/trunk/Lib/test/test_new.py
==============================================================================
--- python/trunk/Lib/test/test_new.py	(original)
+++ python/trunk/Lib/test/test_new.py	Fri May  9 07:18:40 2008
@@ -1,6 +1,7 @@
 import unittest
 from test import test_support
-import sys, new
+import sys
+new = test_support.import_module('new', deprecated=True)
 
 class NewTest(unittest.TestCase):
     def test_spam(self):

Modified: python/trunk/Lib/test/test_py3kwarn.py
==============================================================================
--- python/trunk/Lib/test/test_py3kwarn.py	(original)
+++ python/trunk/Lib/test/test_py3kwarn.py	Fri May  9 07:18:40 2008
@@ -126,7 +126,7 @@
 
 class TestStdlibRemovals(unittest.TestCase):
 
-    all_platforms = ('audiodev', 'imputil', 'mutex', 'user')
+    all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new')
 
     def check_removal(self, module_name):
         """Make sure the specified module, when imported, raises a

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Fri May  9 07:18:40 2008
@@ -20,6 +20,8 @@
 Library
 -------
 
+- The new module has been deprecated for removal in Python 3.0.
+
 - The user module has been deprecated for removal in Python 3.0.
 
 - The stringold module has been deprecated for removal in Python 3.0.


More information about the Python-checkins mailing list