Skip to content

Commit 14d8c68

Browse files
author
brett.cannon
committed
Deprecate the new module for removal in 3.0.
git-svn-id: http://svn.python.org/projects/python/trunk@62917 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 3f66b1f commit 14d8c68

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

Doc/library/new.rst

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
.. module:: new
66
:synopsis: Interface to the creation of runtime implementation objects.
7+
:deprecated:
8+
9+
.. deprecated:: The new module has been removed in Python 3.0.
10+
711
.. sectionauthor:: Moshe Zadka <[email protected]>
812

913

Lib/new.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
This module is no longer required except for backward compatibility.
44
Objects of most types can now be created by calling the type object.
55
"""
6-
from warnings import warnpy3k as _warnpy3k
7-
_warnpy3k("The 'new' module is not supported in 3.x, use the 'types' module "
8-
"instead.", stacklevel=2)
6+
from warnings import warnpy3k
7+
warnpy3k("The 'new' module has been removed in Python 3.0; use the 'types' "
8+
"module instead.", stacklevel=2)
9+
del warnpy3k
910

1011
from types import ClassType as classobj
1112
from types import FunctionType as function

Lib/test/test_new.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import unittest
22
from test import test_support
3-
import sys, new
3+
import sys
4+
new = test_support.import_module('new', deprecated=True)
45

56
class NewTest(unittest.TestCase):
67
def test_spam(self):

Lib/test/test_py3kwarn.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_buffer(self):
126126

127127
class TestStdlibRemovals(unittest.TestCase):
128128

129-
all_platforms = ('audiodev', 'imputil', 'mutex', 'user')
129+
all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new')
130130

131131
def check_removal(self, module_name):
132132
"""Make sure the specified module, when imported, raises a

Misc/NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Extension Modules
2020
Library
2121
-------
2222

23+
- The new module has been deprecated for removal in Python 3.0.
24+
2325
- The user module has been deprecated for removal in Python 3.0.
2426

2527
- The stringold module has been deprecated for removal in Python 3.0.

0 commit comments

Comments
 (0)