[Python-3000-checkins] r59210 - in python/branches/py3k: Doc/library/datatypes.rst Doc/library/new.rst Doc/library/types.rst Lib/new.py Lib/test/test_inspect.py Lib/types.py Lib/xml/dom/domreg.py Lib/xml/dom/expatbuilder.py Lib/xml/dom/minidom.py Misc/NEWS

christian.heimes python-3000-checkins at python.org
Wed Nov 28 09:28:29 CET 2007


Author: christian.heimes
Date: Wed Nov 28 09:28:28 2007
New Revision: 59210

Removed:
   python/branches/py3k/Doc/library/new.rst
   python/branches/py3k/Lib/new.py
Modified:
   python/branches/py3k/Doc/library/datatypes.rst
   python/branches/py3k/Doc/library/types.rst
   python/branches/py3k/Lib/test/test_inspect.py
   python/branches/py3k/Lib/types.py
   python/branches/py3k/Lib/xml/dom/domreg.py
   python/branches/py3k/Lib/xml/dom/expatbuilder.py
   python/branches/py3k/Lib/xml/dom/minidom.py
   python/branches/py3k/Misc/NEWS
Log:
Removed the new module
Removed a lot of types from the 'types' module that are available through builtins.

Modified: python/branches/py3k/Doc/library/datatypes.rst
==============================================================================
--- python/branches/py3k/Doc/library/datatypes.rst	(original)
+++ python/branches/py3k/Doc/library/datatypes.rst	Wed Nov 28 09:28:28 2007
@@ -31,7 +31,6 @@
    weakref.rst
    userdict.rst
    types.rst
-   new.rst
    copy.rst
    pprint.rst
    repr.rst

Deleted: /python/branches/py3k/Doc/library/new.rst
==============================================================================
--- /python/branches/py3k/Doc/library/new.rst	Wed Nov 28 09:28:28 2007
+++ (empty file)
@@ -1,55 +0,0 @@
-
-:mod:`new` --- Creation of runtime internal objects
-===================================================
-
-.. module:: new
-   :synopsis: Interface to the creation of runtime implementation objects.
-.. sectionauthor:: Moshe Zadka <moshez at zadka.site.co.il>
-
-
-The :mod:`new` module allows an interface to the interpreter object creation
-functions. This is for use primarily in marshal-type functions, when a new
-object needs to be created "magically" and not by using the regular creation
-functions. This module provides a low-level interface to the interpreter, so
-care must be exercised when using this module. It is possible to supply
-non-sensical arguments which crash the interpreter when the object is used.
-
-The :mod:`new` module defines the following functions:
-
-
-.. function:: instancemethod(function, instance)
-
-   This function will return a method object, bound to *instance*.
-   *function* must be callable.
-
-   .. XXX no unbound methods anymore
-
-
-.. function:: function(code, globals[, name[, argdefs[, closure]]])
-
-   Returns a (Python) function with the given code and globals. If *name* is given,
-   it must be a string or ``None``.  If it is a string, the function will have the
-   given name, otherwise the function name will be taken from ``code.co_name``.  If
-   *argdefs* is given, it must be a tuple and will be used to determine the default
-   values of parameters.  If *closure* is given, it must be ``None`` or a tuple of
-   cell objects containing objects to bind to the names in ``code.co_freevars``.
-
-
-.. function:: code(argcount, nlocals, stacksize, flags, codestring, constants, names, varnames, filename, name, firstlineno, lnotab)
-
-   This function is an interface to the :cfunc:`PyCode_New` C function.
-
-   .. XXX This is still undocumented!!!
-
-
-.. function:: module(name[, doc])
-
-   This function returns a new module object with name *name*. *name* must be a
-   string. The optional *doc* argument can have any type.
-
-
-.. function:: classobj(name, baseclasses, dict)
-
-   This function returns a new class object, with name *name*, derived from
-   *baseclasses* (which should be a tuple of classes) and with namespace *dict*.
-   Alias for the built-in :class:`type`.

Modified: python/branches/py3k/Doc/library/types.rst
==============================================================================
--- python/branches/py3k/Doc/library/types.rst	(original)
+++ python/branches/py3k/Doc/library/types.rst	Wed Nov 28 09:28:28 2007
@@ -33,77 +33,10 @@
        else:
           mylist.remove(item)
 
-The module defines the following names:
-
-
-.. data:: NoneType
-
-   The type of ``None``.
-
-
-.. data:: TypeType
-          ClassType
-
-   .. index:: builtin: type
-
-   The type of type objects (such as returned by :func:`type`) and user-defined
-   classes without metaclass; alias of the built-in :class:`type`.
-
-
-.. data:: ObjectType
-
-   Alias of the built-in :func:`object`.
-
-
-.. data:: BooleanType
-
-   The type of the :class:`bool` values ``True`` and ``False``; alias of the
-   built-in :class:`bool`.
-
-
-.. data:: IntType
-          LongType
-
-   The type of integers (e.g. ``1``); alias of the built-in :class:`int`.
-
-
-.. data:: FloatType
-
-   The type of floating point numbers (e.g. ``1.0``); alias of the built-in
-   :class:`float`.
-
-
-.. data:: ComplexType
-
-   The type of complex numbers (e.g. ``1.0j``); alias of the built-in
-   :class:`complex`.  This is not defined if Python was built without complex
-   number support.
-
-
-.. data:: StringType
-
-   The type of character strings (e.g. ``'Spam'``); alias of the built-in
-   :class:`str`.
-
-
-.. data:: TupleType
-
-   The type of tuples (e.g. ``(1, 2, 3, 'Spam')``); alias of the built-in
-   :class:`tuple`.
-
-
-.. data:: ListType
-
-   The type of lists (e.g. ``[0, 1, 2, 3]``); alias of the built-in
-   :class:`list`.
-
-
-.. data:: DictType
-          DictionaryType
-
-   The type of dictionaries (e.g. ``{'Bacon': 1, 'Ham': 0}``); alias of the
-   built-in :class:`dict`.
+Starting in Python 3.0 all types that are also available as builtins are no
+longer exposed through the types module.
 
+The module defines the following names:
 
 .. data:: FunctionType
           LambdaType
@@ -141,19 +74,6 @@
    The type of modules.
 
 
-.. data:: SliceType
-
-   .. index:: builtin: slice
-
-   The type of objects returned by :func:`slice`; alias of the built-in
-   :class:`slice`.
-
-
-.. data:: EllipsisType
-
-   The type of ``Ellipsis``.
-
-
 .. data:: TracebackType
 
    The type of traceback objects such as found in ``sys.exc_info()[2]``.
@@ -165,22 +85,9 @@
    traceback object.
 
 
-.. XXX!
-.. data:: BufferType
-
-   .. index:: builtin: buffer
-
-   The type of buffer objects created by the :func:`buffer` function.
-
-
 .. data:: DictProxyType
 
-   The type of dict proxies, such as ``TypeType.__dict__``.
-
-
-.. data:: NotImplementedType
-
-   The type of ``NotImplemented``
+   The type of dict proxies, such as ``type.__dict__``.
 
 
 .. data:: GetSetDescriptorType

Deleted: /python/branches/py3k/Lib/new.py
==============================================================================
--- /python/branches/py3k/Lib/new.py	Wed Nov 28 09:28:28 2007
+++ (empty file)
@@ -1,14 +0,0 @@
-"""Create new objects of various types.  Deprecated.
-
-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 warn as _warn
-_warn("The 'new' module is not supported in 3.x, use the 'types' module "
-    "instead.", DeprecationWarning, 2)
-
-classobj = type
-from types import FunctionType as function
-from types import MethodType as instancemethod
-from types import ModuleType as module
-from types import CodeType as code

Modified: python/branches/py3k/Lib/test/test_inspect.py
==============================================================================
--- python/branches/py3k/Lib/test/test_inspect.py	(original)
+++ python/branches/py3k/Lib/test/test_inspect.py	Wed Nov 28 09:28:28 2007
@@ -364,7 +364,7 @@
                                      formatted='(*arg1, arg2=1)')
 
         self.assertFullArgSpecEquals(mod2.annotated, ['arg1'],
-                                     ann_e={'arg1':types.ListType},
+                                     ann_e={'arg1' : list},
                                      formatted='(arg1: list)')
 
     def test_getargspec_method(self):

Modified: python/branches/py3k/Lib/types.py
==============================================================================
--- python/branches/py3k/Lib/types.py	(original)
+++ python/branches/py3k/Lib/types.py	Wed Nov 28 09:28:28 2007
@@ -9,23 +9,6 @@
 # iterator.  Don't check the type!  Use hasattr to check for both
 # "__iter__" and "__next__" attributes instead.
 
-NoneType = type(None)
-TypeType = type
-ObjectType = object
-
-IntType = int
-LongType = int
-FloatType = float
-BooleanType = bool
-try:
-    ComplexType = complex
-except NameError:
-    pass
-
-TupleType = tuple
-ListType = list
-DictType = DictionaryType = dict
-
 def _f(): pass
 FunctionType = type(_f)
 LambdaType = type(lambda: None)         # Same as FunctionType
@@ -53,11 +36,7 @@
     FrameType = type(tb.tb_frame)
     tb = None; del tb
 
-SliceType = slice
-EllipsisType = type(Ellipsis)
-
-DictProxyType = type(TypeType.__dict__)
-NotImplementedType = type(NotImplemented)
+DictProxyType = type(type.__dict__)
 
 # Extension types defined in a C helper module.  XXX There may be no
 # equivalent in implementations other than CPython, so it seems better to

Modified: python/branches/py3k/Lib/xml/dom/domreg.py
==============================================================================
--- python/branches/py3k/Lib/xml/dom/domreg.py	(original)
+++ python/branches/py3k/Lib/xml/dom/domreg.py	Wed Nov 28 09:28:28 2007
@@ -62,7 +62,7 @@
 
     # User did not specify a name, try implementations in arbitrary
     # order, returning the one that has the required features
-    if isinstance(features, StringTypes):
+    if isinstance(features, str):
         features = _parse_feature_string(features)
     for creator in registered.values():
         dom = creator()

Modified: python/branches/py3k/Lib/xml/dom/expatbuilder.py
==============================================================================
--- python/branches/py3k/Lib/xml/dom/expatbuilder.py	(original)
+++ python/branches/py3k/Lib/xml/dom/expatbuilder.py	Wed Nov 28 09:28:28 2007
@@ -918,7 +918,7 @@
     else:
         builder = ExpatBuilder()
 
-    if isinstance(file, StringTypes):
+    if isinstance(file, str):
         fp = open(file, 'rb')
         try:
             result = builder.parseFile(fp)
@@ -952,7 +952,7 @@
     else:
         builder = FragmentBuilder(context)
 
-    if isinstance(file, StringTypes):
+    if isinstance(file, str):
         fp = open(file, 'rb')
         try:
             result = builder.parseFile(fp)

Modified: python/branches/py3k/Lib/xml/dom/minidom.py
==============================================================================
--- python/branches/py3k/Lib/xml/dom/minidom.py	(original)
+++ python/branches/py3k/Lib/xml/dom/minidom.py	Wed Nov 28 09:28:28 2007
@@ -498,7 +498,7 @@
         return L
 
     def __contains__(self, key):
-        if isinstance(key, StringTypes):
+        if isinstance(key, str):
             return key in self._attrs
         else:
             return key in self._attrsNS
@@ -531,7 +531,7 @@
 
     # same as set
     def __setitem__(self, attname, value):
-        if isinstance(value, StringTypes):
+        if isinstance(value, str):
             try:
                 node = self._attrs[attname]
             except KeyError:
@@ -1606,7 +1606,7 @@
         return e
 
     def createTextNode(self, data):
-        if not isinstance(data, StringTypes):
+        if not isinstance(data, str):
             raise TypeError("node contents must be a string")
         t = Text()
         t.data = data
@@ -1614,7 +1614,7 @@
         return t
 
     def createCDATASection(self, data):
-        if not isinstance(data, StringTypes):
+        if not isinstance(data, str):
             raise TypeError("node contents must be a string")
         c = CDATASection()
         c.data = data
@@ -1927,7 +1927,7 @@
 
 def getDOMImplementation(features=None):
     if features:
-        if isinstance(features, StringTypes):
+        if isinstance(features, str):
             features = domreg._parse_feature_string(features)
         for f, v in features:
             if not Document.implementation.hasFeature(f, v):

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Wed Nov 28 09:28:28 2007
@@ -67,6 +67,10 @@
 - The methods `os.tmpnam()`, `os.tempnam()` and `os.tmpfile()` have been
   removed in favor of the tempfile module.
 
+- Removed the 'new' module.
+
+- Removed all types from the 'types' module that are easily accessable through
+  builtins.
 
 What's New in Python 3.0a1?
 ==========================


More information about the Python-3000-checkins mailing list