Kaydet (Commit) d7265d64 authored tarafından Brett Cannon's avatar Brett Cannon

Deprecate the new module for removal in 3.0.

üst d03238a6
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
.. module:: new .. module:: new
:synopsis: Interface to the creation of runtime implementation objects. :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@zadka.site.co.il> .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
......
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
This module is no longer required except for backward compatibility. This module is no longer required except for backward compatibility.
Objects of most types can now be created by calling the type object. Objects of most types can now be created by calling the type object.
""" """
from warnings import warnpy3k as _warnpy3k from warnings import warnpy3k
_warnpy3k("The 'new' module is not supported in 3.x, use the 'types' module " warnpy3k("The 'new' module has been removed in Python 3.0; use the 'types' "
"instead.", stacklevel=2) "module instead.", stacklevel=2)
del warnpy3k
from types import ClassType as classobj from types import ClassType as classobj
from types import FunctionType as function from types import FunctionType as function
......
import unittest import unittest
from test import test_support from test import test_support
import sys, new import sys
new = test_support.import_module('new', deprecated=True)
class NewTest(unittest.TestCase): class NewTest(unittest.TestCase):
def test_spam(self): def test_spam(self):
......
...@@ -126,7 +126,7 @@ class TestPy3KWarnings(unittest.TestCase): ...@@ -126,7 +126,7 @@ class TestPy3KWarnings(unittest.TestCase):
class TestStdlibRemovals(unittest.TestCase): class TestStdlibRemovals(unittest.TestCase):
all_platforms = ('audiodev', 'imputil', 'mutex', 'user') all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new')
def check_removal(self, module_name): def check_removal(self, module_name):
"""Make sure the specified module, when imported, raises a """Make sure the specified module, when imported, raises a
......
...@@ -20,6 +20,8 @@ Extension Modules ...@@ -20,6 +20,8 @@ Extension Modules
Library 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 user module has been deprecated for removal in Python 3.0.
- The stringold module has been deprecated for removal in Python 3.0. - The stringold module has been deprecated for removal in Python 3.0.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment