summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/pickle.rst13
-rw-r--r--Doc/library/xmlrpclib.rst22
-rw-r--r--Doc/whatsnew/2.6.rst9
-rw-r--r--Lib/SimpleHTTPServer.py1
-rw-r--r--Lib/ctypes/test/__init__.py2
-rw-r--r--Lib/ctypes/test/test_checkretval.py1
-rw-r--r--Lib/ctypes/test/test_find.py2
-rw-r--r--Lib/ctypes/test/test_libc.py1
-rw-r--r--Lib/ctypes/test/test_numbers.py2
-rw-r--r--Lib/curses/wrapper.py2
-rw-r--r--Lib/distutils/bcppcompiler.py2
-rw-r--r--Lib/distutils/command/bdist_dumb.py2
-rw-r--r--Lib/distutils/command/bdist_rpm.py1
-rw-r--r--Lib/distutils/command/build_scripts.py2
-rw-r--r--Lib/distutils/command/install.py1
-rw-r--r--Lib/distutils/command/install_headers.py1
-rw-r--r--Lib/distutils/command/register.py2
-rw-r--r--Lib/distutils/filelist.py1
-rw-r--r--Lib/distutils/tests/test_dist.py2
-rw-r--r--Lib/distutils/tests/test_sysconfig.py1
-rw-r--r--Lib/distutils/unixccompiler.py1
-rw-r--r--Lib/email/base64mime.py1
-rw-r--r--Lib/httplib.py1
-rw-r--r--Lib/idlelib/MultiCall.py1
-rw-r--r--Lib/idlelib/RemoteDebugger.py1
-rw-r--r--Lib/idlelib/TreeWidget.py1
-rw-r--r--Lib/idlelib/UndoDelegator.py1
-rw-r--r--Lib/idlelib/keybindingDialog.py2
-rw-r--r--Lib/idlelib/run.py1
-rw-r--r--Lib/lib-tk/tkSimpleDialog.py1
-rw-r--r--Lib/logging/handlers.py3
-rw-r--r--Lib/ntpath.py2
-rw-r--r--Lib/plat-mac/MiniAEFrame.py1
-rw-r--r--Lib/plat-mac/aepack.py1
-rw-r--r--Lib/plat-mac/bgenlocations.py2
-rw-r--r--Lib/plat-mac/macostools.py2
-rw-r--r--Lib/sqlite3/test/hooks.py2
-rw-r--r--Lib/ssl.py2
-rw-r--r--Lib/test/fork_wait.py1
-rw-r--r--Lib/test/list_tests.py1
-rw-r--r--Lib/test/seq_tests.py1
-rw-r--r--Lib/test/test___all__.py2
-rw-r--r--Lib/test/test_abc.py1
-rw-r--r--Lib/test/test_applesingle.py1
-rw-r--r--Lib/test/test_class.py1
-rw-r--r--Lib/test/test_cmd.py1
-rw-r--r--Lib/test/test_compare.py1
-rw-r--r--Lib/test/test_copy.py1
-rw-r--r--Lib/test/test_datetime.py1
-rwxr-xr-xLib/test/test_dbm.py1
-rw-r--r--Lib/test/test_dis.py2
-rw-r--r--Lib/test/test_dummy_threading.py1
-rw-r--r--Lib/test/test_email.py1
-rw-r--r--Lib/test/test_eof.py1
-rw-r--r--Lib/test/test_extcall.py2
-rw-r--r--Lib/test/test_fileinput.py2
-rw-r--r--Lib/test/test_fractions.py2
-rw-r--r--Lib/test/test_getargs2.py3
-rw-r--r--Lib/test/test_gzip.py2
-rwxr-xr-xLib/test/test_htmlparser.py1
-rw-r--r--Lib/test/test_httplib.py1
-rw-r--r--Lib/test/test_imp.py1
-rw-r--r--Lib/test/test_index.py1
-rw-r--r--Lib/test/test_list.py1
-rw-r--r--Lib/test/test_minidom.py9
-rw-r--r--Lib/test/test_module.py2
-rw-r--r--Lib/test/test_modulefinder.py2
-rw-r--r--Lib/test/test_multibytecodec_support.py2
-rw-r--r--Lib/test/test_optparse.py1
-rw-r--r--Lib/test/test_ossaudiodev.py5
-rw-r--r--Lib/test/test_pickle.py1
-rw-r--r--Lib/test/test_pkg.py1
-rw-r--r--Lib/test/test_plistlib.py1
-rw-r--r--Lib/test/test_poll.py2
-rw-r--r--Lib/test/test_posix.py1
-rw-r--r--Lib/test/test_pyclbr.py2
-rw-r--r--Lib/test/test_resource.py1
-rw-r--r--Lib/test/test_rfc822.py1
-rw-r--r--Lib/test/test_scriptpackages.py3
-rw-r--r--Lib/test/test_sgmllib.py3
-rw-r--r--Lib/test/test_site.py3
-rw-r--r--Lib/test/test_socketserver.py1
-rw-r--r--Lib/test/test_sqlite.py1
-rwxr-xr-xLib/test/test_strftime.py2
-rw-r--r--Lib/test/test_support.py1
-rw-r--r--Lib/test/test_tuple.py1
-rw-r--r--Lib/test/test_unpack.py1
-rw-r--r--Lib/test/test_urllib.py4
-rw-r--r--Lib/test/test_urllib2.py6
-rw-r--r--Lib/test/test_urllib2_localnet.py1
-rw-r--r--Lib/test/test_userdict.py1
-rw-r--r--Lib/test/test_userlist.py1
-rwxr-xr-xLib/test/test_userstring.py1
-rw-r--r--Lib/test/test_whichdb.py1
-rw-r--r--Lib/test/test_xml_etree.py3
-rw-r--r--Lib/test/test_xml_etree_c.py3
-rw-r--r--Lib/test/test_xmlrpc.py55
-rw-r--r--Lib/xml/dom/minidom.py2
-rw-r--r--Lib/xmlrpclib.py74
-rw-r--r--Mac/Demo/PICTbrowse/ICONbrowse.py2
-rw-r--r--Mac/Demo/PICTbrowse/PICTbrowse.py1
-rw-r--r--Mac/Demo/PICTbrowse/PICTbrowse2.py1
-rw-r--r--Mac/Demo/PICTbrowse/cicnbrowse.py2
-rw-r--r--Mac/Demo/PICTbrowse/oldPICTbrowse.py1
-rw-r--r--Mac/Demo/example1/dnslookup-1.py1
-rw-r--r--Mac/Demo/example2/dnslookup-2.py1
-rw-r--r--Mac/Demo/imgbrowse/imgbrowse.py2
-rw-r--r--Mac/Demo/imgbrowse/mac_image.py1
-rw-r--r--Mac/Modules/ae/aescan.py2
-rw-r--r--Mac/Modules/ah/ahscan.py1
-rw-r--r--Mac/Modules/app/appscan.py1
-rw-r--r--Mac/Modules/carbonevt/CarbonEvtscan.py2
-rw-r--r--Mac/Modules/cf/cfscan.py1
-rwxr-xr-xMac/Modules/cg/cgscan.py1
-rw-r--r--Mac/Modules/cm/cmscan.py1
-rw-r--r--Mac/Modules/ctl/ctlscan.py1
-rw-r--r--Mac/Modules/dlg/dlgscan.py1
-rw-r--r--Mac/Modules/drag/dragscan.py1
-rw-r--r--Mac/Modules/evt/evtscan.py1
-rw-r--r--Mac/Modules/file/filescan.py1
-rw-r--r--Mac/Modules/fm/fmscan.py1
-rw-r--r--Mac/Modules/folder/folderscan.py1
-rw-r--r--Mac/Modules/help/helpscan.py1
-rw-r--r--Mac/Modules/ibcarbon/IBCarbonscan.py2
-rw-r--r--Mac/Modules/icn/icnscan.py1
-rw-r--r--Mac/Modules/launch/launchscan.py1
-rw-r--r--Mac/Modules/list/listscan.py1
-rw-r--r--Mac/Modules/menu/menuscan.py1
-rw-r--r--Mac/Modules/mlte/mltescan.py1
-rw-r--r--Mac/Modules/osa/osascan.py1
-rw-r--r--Mac/Modules/qd/qdscan.py1
-rw-r--r--Mac/Modules/qdoffs/qdoffsscan.py1
-rw-r--r--Mac/Modules/qt/qtscan.py1
-rw-r--r--Mac/Modules/res/resscan.py2
-rw-r--r--Mac/Modules/scrap/scrapscan.py1
-rw-r--r--Mac/Modules/snd/sndscan.py1
-rw-r--r--Mac/Modules/te/tescan.py1
-rw-r--r--Mac/Modules/win/winscan.py1
-rw-r--r--Misc/ACKS1
-rw-r--r--Modules/syslogmodule.c5
-rw-r--r--PC/VS8.0/build_tkinter.py1
-rw-r--r--PCbuild/build_tkinter.py1
-rwxr-xr-xParser/asdl_c.py2
-rw-r--r--Parser/spark.py1
-rw-r--r--Python/Python-ast.c4
-rw-r--r--Python/import.c27
-rw-r--r--Python/mystrtoul.c8
-rwxr-xr-xTools/faqwiz/faqw.py2
-rwxr-xr-xTools/modulator/Tkextra.py1
-rw-r--r--Tools/pybench/systimes.py2
-rw-r--r--Tools/pynche/ChipViewer.py1
-rw-r--r--Tools/pynche/TypeinViewer.py2
-rwxr-xr-xTools/scripts/logmerge.py2
-rwxr-xr-xTools/scripts/nm2def.py2
-rwxr-xr-xTools/scripts/pindent.py1
-rw-r--r--Tools/scripts/pysource.py2
-rwxr-xr-xTools/scripts/xxci.py1
-rw-r--r--Tools/ssl/get-remote-certificate.py2
-rw-r--r--Tools/unicode/gencodec.py2
-rwxr-xr-xTools/webchecker/wcgui.py1
-rwxr-xr-xTools/webchecker/wsgui.py2
161 files changed, 160 insertions, 288 deletions
diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst
index a9288e6..33bd9c9 100644
--- a/Doc/library/pickle.rst
+++ b/Doc/library/pickle.rst
@@ -451,6 +451,11 @@ can do what they want. [#]_
Pickling and unpickling extension types
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+.. index::
+ single: __reduce__() (pickle protocol)
+ single: __reduce_ex__() (pickle protocol)
+ single: __safe_for_unpickling__ (pickle protocol)
+
When the :class:`Pickler` encounters an object of a type it knows nothing about
--- such as an extension type --- it looks in two places for a hint of how to
pickle it. One alternative is for the object to implement a :meth:`__reduce__`
@@ -526,6 +531,10 @@ unpickling as described above.
Pickling and unpickling external objects
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+.. index::
+ single: persistent_id (pickle protocol)
+ single: persistent_load (pickle protocol)
+
For the benefit of object persistence, the :mod:`pickle` module supports the
notion of a reference to an object outside the pickled data stream. Such
objects are referenced by a "persistent id", which is just an arbitrary string
@@ -615,6 +624,10 @@ with the :meth:`noload` method on the Unpickler.
Subclassing Unpicklers
----------------------
+.. index::
+ single: load_global() (pickle protocol)
+ single: find_global() (pickle protocol)
+
By default, unpickling will import any class that it finds in the pickle data.
You can control exactly what gets unpickled and what gets called by customizing
your unpickler. Unfortunately, exactly how you do this is different depending
diff --git a/Doc/library/xmlrpclib.rst b/Doc/library/xmlrpclib.rst
index dd06c0a..3f0bf3b 100644
--- a/Doc/library/xmlrpclib.rst
+++ b/Doc/library/xmlrpclib.rst
@@ -32,10 +32,7 @@ between conformable Python objects and XML on the wire.
all clients and servers; see http://ontosys.com/xml-rpc/extensions.php for a
description. The *use_datetime* flag can be used to cause date/time values to
be presented as :class:`datetime.datetime` objects; this is false by default.
- :class:`datetime.datetime`, :class:`datetime.date` and :class:`datetime.time`
- objects may be passed to calls. :class:`datetime.date` objects are converted
- with a time of "00:00:00". :class:`datetime.time` objects are converted using
- today's date.
+ :class:`datetime.datetime` objects may be passed to calls.
Both the HTTP and HTTPS transports support the URL syntax extension for HTTP
Basic Authentication: ``http://user:pass@host:port/path``. The ``user:pass``
@@ -79,9 +76,7 @@ between conformable Python objects and XML on the wire.
+---------------------------------+---------------------------------------------+
| :const:`dates` | in seconds since the epoch (pass in an |
| | instance of the :class:`DateTime` class) or |
- | | a :class:`datetime.datetime`, |
- | | :class:`datetime.date` or |
- | | :class:`datetime.time` instance |
+ | | a :class:`datetime.datetime` instance. |
+---------------------------------+---------------------------------------------+
| :const:`binary data` | pass in an instance of the :class:`Binary` |
| | wrapper class |
@@ -211,10 +206,10 @@ The client code for the preceding server::
DateTime Objects
----------------
-This class may be initialized with seconds since the epoch, a time tuple, an ISO
-8601 time/date string, or a :class:`datetime.datetime`, :class:`datetime.date`
-or :class:`datetime.time` instance. It has the following methods, supported
-mainly for internal use by the marshalling/unmarshalling code:
+This class may be initialized with seconds since the epoch, a time
+tuple, an ISO 8601 time/date string, or a :class:`datetime.datetime`
+instance. It has the following methods, supported mainly for internal
+use by the marshalling/unmarshalling code:
.. method:: DateTime.decode(string)
@@ -495,10 +490,7 @@ Convenience Functions
``None`` if no method name is present in the packet. If the XML-RPC packet
represents a fault condition, this function will raise a :exc:`Fault` exception.
The *use_datetime* flag can be used to cause date/time values to be presented as
- :class:`datetime.datetime` objects; this is false by default. Note that even if
- you call an XML-RPC method with :class:`datetime.date` or :class:`datetime.time`
- objects, they are converted to :class:`DateTime` objects internally, so only
- :class:`datetime.datetime` objects will be returned.
+ :class:`datetime.datetime` objects; this is false by default.
.. _xmlrpc-client-example:
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 3f89c03..a0ec071 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -1511,6 +1511,15 @@ code:
.. Issue 1706815
+* The :mod:`xmlrpclib` module no longer automatically converts
+ :class:`datetime.date` and :class:`datetime.time` to the
+ :class:`xmlrpclib.DateTime` type; the conversion semantics were
+ not necessarily correct for all applications. Code using
+ :mod:`xmlrpclib` should convert :class:`date` and :class:`time`
+ instances.
+
+ .. Issue 1330538
+
.. ======================================================================
diff --git a/Lib/SimpleHTTPServer.py b/Lib/SimpleHTTPServer.py
index eea3243..deedd4b 100644
--- a/Lib/SimpleHTTPServer.py
+++ b/Lib/SimpleHTTPServer.py
@@ -14,7 +14,6 @@ import os
import posixpath
import BaseHTTPServer
import urllib
-import urlparse
import cgi
import shutil
import mimetypes
diff --git a/Lib/ctypes/test/__init__.py b/Lib/ctypes/test/__init__.py
index 372c6e8..60b4975 100644
--- a/Lib/ctypes/test/__init__.py
+++ b/Lib/ctypes/test/__init__.py
@@ -1,4 +1,4 @@
-import glob, os, sys, unittest, getopt, time
+import os, sys, unittest, getopt, time
use_resources = []
diff --git a/Lib/ctypes/test/test_checkretval.py b/Lib/ctypes/test/test_checkretval.py
index 28be6c6..d15bd2e 100644
--- a/Lib/ctypes/test/test_checkretval.py
+++ b/Lib/ctypes/test/test_checkretval.py
@@ -1,5 +1,4 @@
import unittest
-import sys
from ctypes import *
diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py
index 9f61cdb..dc05093 100644
--- a/Lib/ctypes/test/test_find.py
+++ b/Lib/ctypes/test/test_find.py
@@ -1,5 +1,5 @@
import unittest
-import os, sys
+import sys
from ctypes import *
from ctypes.util import find_library
from ctypes.test import is_resource_enabled
diff --git a/Lib/ctypes/test/test_libc.py b/Lib/ctypes/test/test_libc.py
index 0e14c2f..b204fae 100644
--- a/Lib/ctypes/test/test_libc.py
+++ b/Lib/ctypes/test/test_libc.py
@@ -1,4 +1,3 @@
-import sys, os
import unittest
from ctypes import *
diff --git a/Lib/ctypes/test/test_numbers.py b/Lib/ctypes/test/test_numbers.py
index 16e69cb..c0732de 100644
--- a/Lib/ctypes/test/test_numbers.py
+++ b/Lib/ctypes/test/test_numbers.py
@@ -1,6 +1,6 @@
from ctypes import *
import unittest
-import sys, struct
+import struct
def valid_ranges(*types):
# given a sequence of numeric types, collect their _type_
diff --git a/Lib/curses/wrapper.py b/Lib/curses/wrapper.py
index 5335204..9f1d867 100644
--- a/Lib/curses/wrapper.py
+++ b/Lib/curses/wrapper.py
@@ -7,7 +7,7 @@ to a sane state so you can read the resulting traceback.
"""
-import sys, curses
+import curses
def wrapper(func, *args, **kwds):
"""Wrapper function that initializes curses and calls another function,
diff --git a/Lib/distutils/bcppcompiler.py b/Lib/distutils/bcppcompiler.py
index 1ab76c5..c5e5cd2 100644
--- a/Lib/distutils/bcppcompiler.py
+++ b/Lib/distutils/bcppcompiler.py
@@ -14,7 +14,7 @@ for the Borland C++ compiler.
__revision__ = "$Id$"
-import sys, os
+import os
from distutils.errors import \
DistutilsExecError, DistutilsPlatformError, \
CompileError, LibError, LinkError, UnknownFileError
diff --git a/Lib/distutils/command/bdist_dumb.py b/Lib/distutils/command/bdist_dumb.py
index f899617..2d39922 100644
--- a/Lib/distutils/command/bdist_dumb.py
+++ b/Lib/distutils/command/bdist_dumb.py
@@ -9,7 +9,7 @@ __revision__ = "$Id$"
import os
from distutils.core import Command
from distutils.util import get_platform
-from distutils.dir_util import create_tree, remove_tree, ensure_relative
+from distutils.dir_util import remove_tree, ensure_relative
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py
index 72f74f9..83efb8e 100644
--- a/Lib/distutils/command/bdist_rpm.py
+++ b/Lib/distutils/command/bdist_rpm.py
@@ -6,7 +6,6 @@ distributions)."""
__revision__ = "$Id$"
import sys, os
-import glob
from distutils.core import Command
from distutils.debug import DEBUG
from distutils.util import get_platform
diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py
index 7b44264..3ac5b0c 100644
--- a/Lib/distutils/command/build_scripts.py
+++ b/Lib/distutils/command/build_scripts.py
@@ -4,7 +4,7 @@ Implements the Distutils 'build_scripts' command."""
__revision__ = "$Id$"
-import sys, os, re
+import os, re
from stat import ST_MODE
from distutils import sysconfig
from distutils.core import Command
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index b768663..e4ee680 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -14,7 +14,6 @@ from distutils.errors import DistutilsPlatformError
from distutils.file_util import write_file
from distutils.util import convert_path, subst_vars, change_root
from distutils.errors import DistutilsOptionError
-from glob import glob
if sys.version < "2.2":
WINDOWS_SCHEME = {
diff --git a/Lib/distutils/command/install_headers.py b/Lib/distutils/command/install_headers.py
index 7114eaf..346daaa 100644
--- a/Lib/distutils/command/install_headers.py
+++ b/Lib/distutils/command/install_headers.py
@@ -5,7 +5,6 @@ files to the Python include directory."""
__revision__ = "$Id$"
-import os
from distutils.core import Command
diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py
index d123d32..40d9f20 100644
--- a/Lib/distutils/command/register.py
+++ b/Lib/distutils/command/register.py
@@ -7,7 +7,7 @@ Implements the Distutils 'register' command (register with the repository).
__revision__ = "$Id$"
-import sys, os, urllib2, getpass, urlparse
+import os, string, urllib2, getpass, urlparse
import io, ConfigParser
from distutils.core import Command
diff --git a/Lib/distutils/filelist.py b/Lib/distutils/filelist.py
index 6506c30..8eab0a9 100644
--- a/Lib/distutils/filelist.py
+++ b/Lib/distutils/filelist.py
@@ -8,7 +8,6 @@ __revision__ = "$Id$"
import os, re
import fnmatch
-from glob import glob
from distutils.util import convert_path
from distutils.errors import DistutilsTemplateError, DistutilsInternalError
from distutils import log
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
index 23506b5..91acf45 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -3,10 +3,8 @@
import distutils.cmd
import distutils.dist
import os
-import shutil
import io
import sys
-import tempfile
import unittest
from test.test_support import TESTFN
diff --git a/Lib/distutils/tests/test_sysconfig.py b/Lib/distutils/tests/test_sysconfig.py
index 770b7c3..d56f7e9 100644
--- a/Lib/distutils/tests/test_sysconfig.py
+++ b/Lib/distutils/tests/test_sysconfig.py
@@ -2,7 +2,6 @@
from distutils import sysconfig
import os
-import sys
import unittest
from test.test_support import TESTFN
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index ee975e1..25a042d 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -16,7 +16,6 @@ the "typical" Unix-style command-line C compiler:
__revision__ = "$Id$"
import os, sys
-from copy import copy
from distutils import sysconfig
from distutils.dep_util import newer
diff --git a/Lib/email/base64mime.py b/Lib/email/base64mime.py
index cff558e..c60f8db 100644
--- a/Lib/email/base64mime.py
+++ b/Lib/email/base64mime.py
@@ -35,7 +35,6 @@ __all__ = [
'header_length',
]
-import re
from base64 import b64encode
from binascii import b2a_base64, a2b_base64
diff --git a/Lib/httplib.py b/Lib/httplib.py
index bb873e4..638a92b 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -66,7 +66,6 @@ Req-started-unread-response _CS_REQ_STARTED <response_class>
Req-sent-unread-response _CS_REQ_SENT <response_class>
"""
-import errno
import io
import mimetools
import socket
diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py
index c59ccfe..f2e3887 100644
--- a/Lib/idlelib/MultiCall.py
+++ b/Lib/idlelib/MultiCall.py
@@ -30,7 +30,6 @@ Each function will be called at most once for each event.
"""
import sys
-import os
import re
import Tkinter
diff --git a/Lib/idlelib/RemoteDebugger.py b/Lib/idlelib/RemoteDebugger.py
index 46582d1..d8662bb 100644
--- a/Lib/idlelib/RemoteDebugger.py
+++ b/Lib/idlelib/RemoteDebugger.py
@@ -20,7 +20,6 @@ barrier, in particular frame and traceback objects.
"""
-import sys
import types
from idlelib import rpc
from idlelib import Debugger
diff --git a/Lib/idlelib/TreeWidget.py b/Lib/idlelib/TreeWidget.py
index 0009de8..04e16a2 100644
--- a/Lib/idlelib/TreeWidget.py
+++ b/Lib/idlelib/TreeWidget.py
@@ -15,7 +15,6 @@
# - optimize tree redraw after expand of subnode
import os
-import sys
from Tkinter import *
import imp
diff --git a/Lib/idlelib/UndoDelegator.py b/Lib/idlelib/UndoDelegator.py
index cdda142..57b02df 100644
--- a/Lib/idlelib/UndoDelegator.py
+++ b/Lib/idlelib/UndoDelegator.py
@@ -1,4 +1,3 @@
-import sys
import string
from Tkinter import *
diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py
index 7f4cc91..f326b6f 100644
--- a/Lib/idlelib/keybindingDialog.py
+++ b/Lib/idlelib/keybindingDialog.py
@@ -3,7 +3,7 @@ Dialog for building Tkinter accelerator key bindings
"""
from Tkinter import *
import tkMessageBox
-import string, os
+import string
class GetKeysDialog(Toplevel):
def __init__(self,parent,title,action,currentKeySequences):
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 407e543..63880d6 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -1,5 +1,4 @@
import sys
-import os
import linecache
import time
import socket
diff --git a/Lib/lib-tk/tkSimpleDialog.py b/Lib/lib-tk/tkSimpleDialog.py
index f4ed77a..573c3a3 100644
--- a/Lib/lib-tk/tkSimpleDialog.py
+++ b/Lib/lib-tk/tkSimpleDialog.py
@@ -26,7 +26,6 @@ askstring -- get a string from the user
'''
from Tkinter import *
-import os
class Dialog(Toplevel):
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 850e3bd..4645f3e 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -24,8 +24,7 @@ Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
-import sys, logging, socket, os, struct, time, glob
-import pickle
+import logging, socket, os, pickle, struct, time, glob
from stat import ST_DEV, ST_INO
try:
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index c4a4ac5..59f1402 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -6,8 +6,8 @@ module as os.path.
"""
import os
-import stat
import sys
+import stat
import genericpath
from genericpath import *
diff --git a/Lib/plat-mac/MiniAEFrame.py b/Lib/plat-mac/MiniAEFrame.py
index eed7428..e2f7cec 100644
--- a/Lib/plat-mac/MiniAEFrame.py
+++ b/Lib/plat-mac/MiniAEFrame.py
@@ -6,7 +6,6 @@ There are two classes:
only suitable for the simplest of AppleEvent servers.
"""
-import sys
import traceback
import MacOS
from Carbon import AE
diff --git a/Lib/plat-mac/aepack.py b/Lib/plat-mac/aepack.py
index 5f8efd2..b030140 100644
--- a/Lib/plat-mac/aepack.py
+++ b/Lib/plat-mac/aepack.py
@@ -20,7 +20,6 @@ import Carbon.File
import io
import aetypes
from aetypes import mkenum, ObjectSpecifier
-import os
# These ones seem to be missing from AppleEvents
# (they're in AERegistry.h)
diff --git a/Lib/plat-mac/bgenlocations.py b/Lib/plat-mac/bgenlocations.py
index 041a6ff..88e8f67 100644
--- a/Lib/plat-mac/bgenlocations.py
+++ b/Lib/plat-mac/bgenlocations.py
@@ -5,7 +5,7 @@
# but mac-style for MacPython, whether running on OS9 or OSX.
#
-import sys, os
+import os
Error = "bgenlocations.Error"
#
diff --git a/Lib/plat-mac/macostools.py b/Lib/plat-mac/macostools.py
index 67d32e7..80c3727 100644
--- a/Lib/plat-mac/macostools.py
+++ b/Lib/plat-mac/macostools.py
@@ -7,9 +7,7 @@ copy(src, dst) - Full copy of 'src' to 'dst'
from Carbon import Res
from Carbon import File, Files
import os
-import sys
import MacOS
-import time
try:
openrf = MacOS.openrf
except AttributeError:
diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py
index d67028f..28f2404 100644
--- a/Lib/sqlite3/test/hooks.py
+++ b/Lib/sqlite3/test/hooks.py
@@ -21,7 +21,7 @@
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
-import os, unittest
+import unittest
import sqlite3 as sqlite
class CollationTests(unittest.TestCase):
diff --git a/Lib/ssl.py b/Lib/ssl.py
index c229cd3..968f9a0 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -54,7 +54,7 @@ PROTOCOL_SSLv23
PROTOCOL_TLSv1
"""
-import os, sys, textwrap
+import textwrap
import _ssl # if we can't import it, let the error propagate
diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py
index 38e2b4f..678e3c4 100644
--- a/Lib/test/fork_wait.py
+++ b/Lib/test/fork_wait.py
@@ -10,7 +10,6 @@ active threads survive in the child after a fork(); this is an error.
"""
import os, sys, time, thread, unittest
-from test.test_support import TestSkipped
LONGSLEEP = 2
SHORTSLEEP = 0.5
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index 49283e4..4ffa668 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -5,7 +5,6 @@ Tests common to list and UserList.UserList
import sys
import os
-import unittest
from test import test_support, seq_tests
def CmpToKey(mycmp):
diff --git a/Lib/test/seq_tests.py b/Lib/test/seq_tests.py
index 81fe627..a3815e2 100644
--- a/Lib/test/seq_tests.py
+++ b/Lib/test/seq_tests.py
@@ -3,7 +3,6 @@ Tests common to tuple, list and UserList.UserList
"""
import unittest
-from test import test_support
import sys
# Various iterables
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index 6e844e7..a2a2519 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -1,5 +1,5 @@
import unittest
-from test.test_support import verbose, run_unittest
+from test.test_support import run_unittest
import sys
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index 80b0123..7a932fc 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -3,7 +3,6 @@
"""Unit tests for abc.py."""
-import sys
import unittest
from test import test_support
diff --git a/Lib/test/test_applesingle.py b/Lib/test/test_applesingle.py
index 96450e3..9dfcb19 100644
--- a/Lib/test/test_applesingle.py
+++ b/Lib/test/test_applesingle.py
@@ -5,7 +5,6 @@ import macostools
import Carbon.File
import MacOS
import os
-import sys
from test import test_support
import struct
import applesingle
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py
index ab44a4c..730826d 100644
--- a/Lib/test/test_class.py
+++ b/Lib/test/test_class.py
@@ -1,7 +1,6 @@
"Test the functionality of Python classes implementing operators."
import unittest
-import sys
from test import test_support
diff --git a/Lib/test/test_cmd.py b/Lib/test/test_cmd.py
index 3ed6322..2c77931 100644
--- a/Lib/test/test_cmd.py
+++ b/Lib/test/test_cmd.py
@@ -5,7 +5,6 @@ Original by Michael Schneider
"""
-from test import test_support
import cmd
import sys
import trace
diff --git a/Lib/test/test_compare.py b/Lib/test/test_compare.py
index 15fe3c2..de32f3c 100644
--- a/Lib/test/test_compare.py
+++ b/Lib/test/test_compare.py
@@ -1,4 +1,3 @@
-import sys
import unittest
from test import test_support
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index cf94593..8b50e47 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -1,6 +1,5 @@
"""Unit tests for the copy module."""
-import sys
import copy
import copy_reg
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index 8ac7160..e768a9c 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -4,7 +4,6 @@ See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases
"""
import os
-import sys
import pickle
import unittest
diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py
index 806125f..4c97a4c 100755
--- a/Lib/test/test_dbm.py
+++ b/Lib/test/test_dbm.py
@@ -3,7 +3,6 @@
Roger E. Masse
"""
import os
-import random
import dbm
from dbm import error
from test.test_support import verbose, verify, TestSkipped, TESTFN
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index f135780..ceb7509 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -1,6 +1,6 @@
# Minimal tests for dis module
-from test.test_support import verbose, run_unittest
+from test.test_support import run_unittest
import unittest
import sys
import dis
diff --git a/Lib/test/test_dummy_threading.py b/Lib/test/test_dummy_threading.py
index 90bf6e0..6f16241 100644
--- a/Lib/test/test_dummy_threading.py
+++ b/Lib/test/test_dummy_threading.py
@@ -3,7 +3,6 @@
# Create a bunch of threads, let each do some work, wait until all are done
from test.test_support import verbose
-import random
import dummy_threading as _threading
import time
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py
index 736c393..e12cbd3 100644
--- a/Lib/test/test_email.py
+++ b/Lib/test/test_email.py
@@ -1,7 +1,6 @@
# Copyright (C) 2001-2007 Python Software Foundation
# email package unit tests
-import unittest
# The specific tests now live in Lib/email/test
from email.test.test_email import suite
from test import test_support
diff --git a/Lib/test/test_eof.py b/Lib/test/test_eof.py
index 1187d07..4284d11 100644
--- a/Lib/test/test_eof.py
+++ b/Lib/test/test_eof.py
@@ -1,7 +1,6 @@
#! /usr/bin/env python
"""test script for a few new invalid token catches"""
-import os
import unittest
from test import test_support
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py
index 596a3ef..bad1440 100644
--- a/Lib/test/test_extcall.py
+++ b/Lib/test/test_extcall.py
@@ -1,4 +1,4 @@
-from test.test_support import verify, verbose, TestFailed, sortdict
+from test.test_support import verify, TestFailed, sortdict
from collections import UserDict, UserList
def e(a, b):
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py
index 2ba3bc3..aa38527 100644
--- a/Lib/test/test_fileinput.py
+++ b/Lib/test/test_fileinput.py
@@ -6,7 +6,7 @@ Nick Mathewson
import unittest
from test.test_support import verbose, TESTFN, run_unittest
from test.test_support import unlink as safe_unlink
-import sys, os, re
+import sys, re
from io import StringIO
from fileinput import FileInput, hook_encoded
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index dacb587..21c1761 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -1,7 +1,7 @@
"""Tests for Lib/fractions.py."""
from decimal import Decimal
-from test.test_support import run_unittest, verbose
+from test.test_support import run_unittest
import math
import operator
import fractions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index 9172576..4253141 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -1,8 +1,7 @@
import unittest
from test import test_support
-import sys
-import warnings, re
+import warnings
warnings.filterwarnings("ignore",
category=DeprecationWarning,
message=".*integer argument expected, got float",
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 31000df..08f7f3f 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -4,7 +4,7 @@
import unittest
from test import test_support
-import sys, os
+import os
import gzip
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py
index b408a18..a4f2c34 100755
--- a/Lib/test/test_htmlparser.py
+++ b/Lib/test/test_htmlparser.py
@@ -2,7 +2,6 @@
import HTMLParser
import pprint
-import sys
import unittest
from test import test_support
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index 7e5a8a5..4caf996 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -1,6 +1,5 @@
import httplib
import io
-import sys
import socket
from unittest import TestCase
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 3b0a13d..13a3bfd 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -1,5 +1,4 @@
import imp
-import thread
import unittest
from test import test_support
diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py
index 9a22020..71cfb15 100644
--- a/Lib/test/test_index.py
+++ b/Lib/test/test_index.py
@@ -1,7 +1,6 @@
import unittest
from test import test_support
import operator
-import sys
maxsize = test_support.MAX_Py_ssize_t
minsize = -maxsize-1
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
index 5b84a42..b3b2195 100644
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -1,4 +1,3 @@
-import unittest
import sys
from test import test_support, list_tests
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index d1a72bd..9ea60a9 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -3,7 +3,6 @@
import os
import sys
import pickle
-import traceback
from io import StringIO
from test.test_support import verbose, run_unittest, TestSkipped
import unittest
@@ -791,6 +790,14 @@ class MinidomTest(unittest.TestCase):
"testNormalize -- single empty node removed")
doc.unlink()
+ def testBug1433694(self):
+ doc = parseString("<o><i/>t</o>")
+ node = doc.documentElement
+ node.childNodes[1].nodeValue = ""
+ node.normalize()
+ self.confirm(node.childNodes[-1].nextSibling == None,
+ "Final child's .nextSibling should be None")
+
def testSiblings(self):
doc = parseString("<doc><?pi?>text?<elm/></doc>")
root = doc.documentElement
diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py
index d091c6b..35c765e 100644
--- a/Lib/test/test_module.py
+++ b/Lib/test/test_module.py
@@ -1,6 +1,6 @@
# Test the module type
import unittest
-from test.test_support import verbose, run_unittest
+from test.test_support import run_unittest
import sys
ModuleType = type(sys)
diff --git a/Lib/test/test_modulefinder.py b/Lib/test/test_modulefinder.py
index 3bc22ab..80c06d7 100644
--- a/Lib/test/test_modulefinder.py
+++ b/Lib/test/test_modulefinder.py
@@ -1,5 +1,5 @@
import __future__
-import sys, os
+import os
import unittest
import distutils.dir_util
import tempfile
diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py
index 6b67057..42df9d7 100644
--- a/Lib/test/test_multibytecodec_support.py
+++ b/Lib/test/test_multibytecodec_support.py
@@ -4,7 +4,7 @@
# Common Unittest Routines for CJK codecs
#
-import sys, codecs, os.path
+import sys, codecs
import unittest, re
from test import test_support
from io import BytesIO
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
index 1cfdd50..71de869 100644
--- a/Lib/test/test_optparse.py
+++ b/Lib/test/test_optparse.py
@@ -15,7 +15,6 @@ import copy
import unittest
from io import StringIO
-from pprint import pprint
from test import test_support
diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py
index 97d5989..8f9bf6f 100644
--- a/Lib/test/test_ossaudiodev.py
+++ b/Lib/test/test_ossaudiodev.py
@@ -1,14 +1,11 @@
from test import test_support
test_support.requires('audio')
-from test.test_support import verbose, findfile, TestSkipped
+from test.test_support import findfile, TestSkipped
import errno
-import fcntl
import ossaudiodev
-import os
import sys
-import select
import sunaudio
import time
import audioop
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index f54381f..aa09a6a 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -1,5 +1,4 @@
import pickle
-import unittest
import io
from test import test_support
diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py
index 630956d..dcc7433 100644
--- a/Lib/test/test_pkg.py
+++ b/Lib/test/test_pkg.py
@@ -4,7 +4,6 @@ import sys
import os
import tempfile
import textwrap
-import traceback
import unittest
from test import test_support
diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py
index 5c6a059..883b01f 100644
--- a/Lib/test/test_plistlib.py
+++ b/Lib/test/test_plistlib.py
@@ -3,7 +3,6 @@
import unittest
import plistlib
import os
-import time
import datetime
from test import test_support
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
index a6110e6..cd9bfb0 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -1,6 +1,6 @@
# Test case for the os.poll() function
-import sys, os, select, random, unittest
+import os, select, random, unittest
from test.test_support import TestSkipped, TESTFN, run_unittest
try:
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index efd5fb0..13f8f9e 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -9,7 +9,6 @@ except ImportError:
import time
import os
-import sys
import unittest
import warnings
warnings.filterwarnings('ignore', '.* potential security risk .*',
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index f041823..c96ae6d 100644
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -3,7 +3,7 @@
Nick Mathewson
'''
from test.test_support import run_unittest
-import unittest, sys
+import sys
from types import FunctionType, MethodType, BuiltinFunctionType
import pyclbr
from unittest import TestCase
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 86440b5..b66caf8 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -1,7 +1,6 @@
import unittest
from test import test_support
-import os
import resource
import time
diff --git a/Lib/test/test_rfc822.py b/Lib/test/test_rfc822.py
index b563c9c..1f5dd64 100644
--- a/Lib/test/test_rfc822.py
+++ b/Lib/test/test_rfc822.py
@@ -1,5 +1,4 @@
import rfc822
-import sys
import unittest
from test import test_support
diff --git a/Lib/test/test_scriptpackages.py b/Lib/test/test_scriptpackages.py
index a2e03f9..ee14be2 100644
--- a/Lib/test/test_scriptpackages.py
+++ b/Lib/test/test_scriptpackages.py
@@ -1,9 +1,6 @@
# Copyright (C) 2003 Python Software Foundation
import unittest
-import os
-import sys
-import tempfile
from test import test_support
import aetools
diff --git a/Lib/test/test_sgmllib.py b/Lib/test/test_sgmllib.py
index f0f8ad6..374b921 100644
--- a/Lib/test/test_sgmllib.py
+++ b/Lib/test/test_sgmllib.py
@@ -1,4 +1,3 @@
-import htmlentitydefs
import pprint
import re
import sgmllib
@@ -116,7 +115,7 @@ class SGMLParserTestCase(unittest.TestCase):
try:
events = self.get_events(source)
except:
- import sys
+ #import sys
#print >>sys.stderr, pprint.pformat(self.events)
raise
if events != expected_events:
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 4624ea6..b80d6e6 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -5,12 +5,11 @@ executing have not been removed.
"""
import unittest
-from test.test_support import TestSkipped, TestFailed, run_unittest, TESTFN
+from test.test_support import TestSkipped, run_unittest, TESTFN
import builtins
import os
import sys
import encodings
-import tempfile
# Need to make sure to not import 'site' if someone specified ``-S`` at the
# command-line. Detect this by just making sure 'site' has not been imported
# already.
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 0fccdd9..69f0b53 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -9,7 +9,6 @@ import imp
import select
import time
import threading
-from functools import wraps
import unittest
import SocketServer
diff --git a/Lib/test/test_sqlite.py b/Lib/test/test_sqlite.py
index f033772..c1523e1 100644
--- a/Lib/test/test_sqlite.py
+++ b/Lib/test/test_sqlite.py
@@ -1,5 +1,4 @@
from test.test_support import run_unittest, TestSkipped
-import unittest
try:
import _sqlite3
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py
index c6db3dd..0870134 100755
--- a/Lib/test/test_strftime.py
+++ b/Lib/test/test_strftime.py
@@ -2,7 +2,7 @@
# Sanity checker for time.strftime
-import time, calendar, sys, os, re
+import time, calendar, sys, re
from test.test_support import verbose
def main():
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 0fd5d88..ba36448 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -10,7 +10,6 @@ import sys
import os
import os.path
import warnings
-import types
import unittest
class Error(Exception):
diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py
index 1da0ef3..62c5d71 100644
--- a/Lib/test/test_tuple.py
+++ b/Lib/test/test_tuple.py
@@ -1,4 +1,3 @@
-import unittest
from test import test_support, seq_tests
class TupleTest(seq_tests.CommonTest):
diff --git a/Lib/test/test_unpack.py b/Lib/test/test_unpack.py
index 75033ed..a90b5e5 100644
--- a/Lib/test/test_unpack.py
+++ b/Lib/test/test_unpack.py
@@ -122,7 +122,6 @@ error)
__test__ = {'doctests' : doctests}
def test_main(verbose=False):
- import sys
from test import test_support
from test import test_unpack
test_support.run_doctest(test_unpack, verbose)
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index c233e35..d58414c 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -8,10 +8,6 @@ from test import test_support
import os
import mimetools
import tempfile
-import ftplib
-import threading
-import socket
-import time
def hexescape(char):
"""Escape char as RFC 2396 specifies"""
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 199119a..6ceec06 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1,7 +1,7 @@
import unittest
from test import test_support
-import os, socket
+import os
import io
import urllib2
@@ -584,7 +584,7 @@ class HandlerTests(unittest.TestCase):
self.assertEqual(int(headers["Content-length"]), len(data))
def test_file(self):
- import time, rfc822, socket
+ import rfc822, socket
h = urllib2.FileHandler()
o = h.parent = MockOpener()
@@ -988,7 +988,7 @@ class HandlerTests(unittest.TestCase):
def _test_basic_auth(self, opener, auth_handler, auth_header,
realm, http_handler, password_manager,
request_url, protected_url):
- import base64, httplib
+ import base64
user, password = "wile", "coyote"
# .add_password() fed through to password manager
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
index f0b5dea..663330b 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python
-import sys
import threading
import urlparse
import urllib2
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
index 643caf9..3a8a8b4 100644
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -1,6 +1,5 @@
# Check every path through every method of UserDict
-import unittest
from test import test_support, mapping_tests
import collections
diff --git a/Lib/test/test_userlist.py b/Lib/test/test_userlist.py
index 9d012e0..a0daa4e 100644
--- a/Lib/test/test_userlist.py
+++ b/Lib/test/test_userlist.py
@@ -1,7 +1,6 @@
# Check every path through every method of UserList
from collections import UserList
-import unittest
from test import test_support, list_tests
class UserListTest(list_tests.CommonTest):
diff --git a/Lib/test/test_userstring.py b/Lib/test/test_userstring.py
index a0fefc3..e8fb135 100755
--- a/Lib/test/test_userstring.py
+++ b/Lib/test/test_userstring.py
@@ -2,7 +2,6 @@
# UserString is a wrapper around the native builtin string type.
# UserString instances should behave similar to builtin string objects.
-import unittest
import string
from test import test_support, string_tests
diff --git a/Lib/test/test_whichdb.py b/Lib/test/test_whichdb.py
index 7746329..e63eb0f 100644
--- a/Lib/test/test_whichdb.py
+++ b/Lib/test/test_whichdb.py
@@ -8,7 +8,6 @@ import test.test_support
import unittest
import whichdb
import anydbm
-import tempfile
import glob
from test.test_anydbm import delete_files, dbm_iterator
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 1a6b7f3..8470584 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -2,7 +2,8 @@
# all included components work as they should. For a more extensive
# test suite, see the selftest script in the ElementTree distribution.
-import doctest, sys
+import doctest
+import sys
from test import test_support
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py
index c8eec40..80e91d1 100644
--- a/Lib/test/test_xml_etree_c.py
+++ b/Lib/test/test_xml_etree_c.py
@@ -1,6 +1,7 @@
# xml.etree test for cElementTree
-import doctest, sys
+import doctest
+import sys
from test import test_support
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index 092be51..0836533 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -26,10 +26,6 @@ alist = [{'astring': 'foo@bar.baz.spam',
(2005, 2, 10, 11, 41, 23, 0, 1, -1)),
'datetime3': xmlrpclib.DateTime(
datetime.datetime(2005, 2, 10, 11, 41, 23)),
- 'datetime4': xmlrpclib.DateTime(
- datetime.date(2005, 2, 10)),
- 'datetime5': xmlrpclib.DateTime(
- datetime.time(11, 41, 23)),
}]
class XMLRPCTestCase(unittest.TestCase):
@@ -53,34 +49,14 @@ class XMLRPCTestCase(unittest.TestCase):
(newdt,), m = xmlrpclib.loads(s, use_datetime=0)
self.assertEquals(newdt, xmlrpclib.DateTime('20050210T11:41:23'))
- def test_dump_bare_date(self):
- # This checks that an unwrapped datetime.date object can be handled
- # by the marshalling code. This can't be done via test_dump_load()
- # since the unmarshaller produces a datetime object
- d = datetime.datetime(2005, 2, 10, 11, 41, 23).date()
- s = xmlrpclib.dumps((d,))
- (newd,), m = xmlrpclib.loads(s, use_datetime=1)
- self.assertEquals(newd.date(), d)
- self.assertEquals(newd.time(), datetime.time(0, 0, 0))
- self.assertEquals(m, None)
-
- (newdt,), m = xmlrpclib.loads(s, use_datetime=0)
- self.assertEquals(newdt, xmlrpclib.DateTime('20050210T00:00:00'))
-
- def test_dump_bare_time(self):
- # This checks that an unwrapped datetime.time object can be handled
- # by the marshalling code. This can't be done via test_dump_load()
- # since the unmarshaller produces a datetime object
- t = datetime.datetime(2005, 2, 10, 11, 41, 23).time()
- s = xmlrpclib.dumps((t,))
- (newt,), m = xmlrpclib.loads(s, use_datetime=1)
- today = datetime.datetime.now().date().strftime("%Y%m%d")
- self.assertEquals(newt.time(), t)
- self.assertEquals(newt.date(), datetime.datetime.now().date())
- self.assertEquals(m, None)
-
- (newdt,), m = xmlrpclib.loads(s, use_datetime=0)
- self.assertEquals(newdt, xmlrpclib.DateTime('%sT11:41:23'%today))
+ def test_cmp_datetime_DateTime(self):
+ now = datetime.datetime.now()
+ dt = xmlrpclib.DateTime(now.timetuple())
+ self.assert_(dt == now)
+ self.assert_(now == dt)
+ then = now + datetime.timedelta(seconds=4)
+ self.assert_(then >= dt)
+ self.assert_(dt < then)
def test_bug_1164912 (self):
d = xmlrpclib.DateTime()
@@ -201,21 +177,6 @@ class DateTimeTestCase(unittest.TestCase):
t = xmlrpclib.DateTime(d)
self.assertEqual(str(t), '20070102T03:04:05')
- def test_datetime_date(self):
- d = datetime.date(2007,9,8)
- t = xmlrpclib.DateTime(d)
- self.assertEqual(str(t), '20070908T00:00:00')
-
- def test_datetime_time(self):
- d = datetime.time(13,17,19)
- # allow for date rollover by checking today's or tomorrow's dates
- dd1 = datetime.datetime.now().date()
- dd2 = dd1 + datetime.timedelta(days=1)
- vals = (dd1.strftime('%Y%m%dT13:17:19'),
- dd2.strftime('%Y%m%dT13:17:19'))
- t = xmlrpclib.DateTime(d)
- self.assertEqual(str(t) in vals, True)
-
def test_repr(self):
d = datetime.datetime(2007,1,2,3,4,5)
t = xmlrpclib.DateTime(d)
diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py
index 3087a5c..b6f0a862 100644
--- a/Lib/xml/dom/minidom.py
+++ b/Lib/xml/dom/minidom.py
@@ -204,6 +204,8 @@ class Node(xml.dom.Node):
L.append(child)
if child.nodeType == Node.ELEMENT_NODE:
child.normalize()
+ if L:
+ L[-1].nextSibling = None
self.childNodes[:] = L
def cloneNode(self, deep):
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py
index da96420..2e68a1b 100644
--- a/Lib/xmlrpclib.py
+++ b/Lib/xmlrpclib.py
@@ -298,13 +298,6 @@ class DateTime:
if datetime and isinstance(value, datetime.datetime):
self.value = value.strftime("%Y%m%dT%H:%M:%S")
return
- if datetime and isinstance(value, datetime.date):
- self.value = value.strftime("%Y%m%dT%H:%M:%S")
- return
- if datetime and isinstance(value, datetime.time):
- today = datetime.datetime.now().strftime("%Y%m%d")
- self.value = value.strftime(today+"T%H:%M:%S")
- return
if not isinstance(value, (tuple, time.struct_time)):
if value == 0:
value = time.time()
@@ -312,15 +305,57 @@ class DateTime:
value = time.strftime("%Y%m%dT%H:%M:%S", value)
self.value = value
- def __eq__(self, other):
+ def make_comparable(self, other):
if isinstance(other, DateTime):
- other = other.value
- return self.value == other
+ s = self.value
+ o = other.value
+ elif datetime and isinstance(other, datetime.datetime):
+ s = self.value
+ o = other.strftime("%Y%m%dT%H:%M:%S")
+ elif isinstance(other, (str, unicode)):
+ s = self.value
+ o = other
+ elif hasattr(other, "timetuple"):
+ s = self.timetuple()
+ o = other.timetuple()
+ else:
+ otype = (hasattr(other, "__class__")
+ and other.__class__.__name__
+ or type(other))
+ raise TypeError("Can't compare %s and %s" %
+ (self.__class__.__name__, otype))
+ return s, o
+
+ def __lt__(self, other):
+ s, o = self.make_comparable(other)
+ return s < o
+
+ def __le__(self, other):
+ s, o = self.make_comparable(other)
+ return s <= o
+
+ def __gt__(self, other):
+ s, o = self.make_comparable(other)
+ return s > o
+
+ def __ge__(self, other):
+ s, o = self.make_comparable(other)
+ return s >= o
+
+ def __eq__(self, other):
+ s, o = self.make_comparable(other)
+ return s == o
def __ne__(self, other):
- if isinstance(other, DateTime):
- other = other.value
- return self.value != other
+ s, o = self.make_comparable(other)
+ return s != o
+
+ def timetuple(self):
+ return time.strptime(self.value, "%Y%m%dT%H:%M:%S")
+
+ def __cmp__(self, other):
+ s, o = self.make_comparable(other)
+ return cmp(s, o)
##
# Get date/time value.
@@ -669,19 +704,6 @@ class Marshaller:
write("</dateTime.iso8601></value>\n")
dispatch[datetime.datetime] = dump_datetime
- def dump_date(self, value, write):
- write("<value><dateTime.iso8601>")
- write(value.strftime("%Y%m%dT00:00:00"))
- write("</dateTime.iso8601></value>\n")
- dispatch[datetime.date] = dump_date
-
- def dump_time(self, value, write):
- write("<value><dateTime.iso8601>")
- write(datetime.datetime.now().date().strftime("%Y%m%dT"))
- write(value.strftime("%H:%M:%S"))
- write("</dateTime.iso8601></value>\n")
- dispatch[datetime.time] = dump_time
-
def dump_instance(self, value, write):
# check for special wrappers
if value.__class__ in WRAPPERS:
diff --git a/Mac/Demo/PICTbrowse/ICONbrowse.py b/Mac/Demo/PICTbrowse/ICONbrowse.py
index 701ef7f..f55070b 100644
--- a/Mac/Demo/PICTbrowse/ICONbrowse.py
+++ b/Mac/Demo/PICTbrowse/ICONbrowse.py
@@ -7,8 +7,6 @@ from Carbon import Qd
from Carbon import Win
from Carbon import Controls
from Carbon import List
-import sys
-import struct
from Carbon import Icn
import macresource
diff --git a/Mac/Demo/PICTbrowse/PICTbrowse.py b/Mac/Demo/PICTbrowse/PICTbrowse.py
index 83f431e..e2bc87b 100644
--- a/Mac/Demo/PICTbrowse/PICTbrowse.py
+++ b/Mac/Demo/PICTbrowse/PICTbrowse.py
@@ -7,7 +7,6 @@ from Carbon import Qd
from Carbon import Win
from Carbon import Controls
from Carbon import List
-import sys
import struct
import macresource
diff --git a/Mac/Demo/PICTbrowse/PICTbrowse2.py b/Mac/Demo/PICTbrowse/PICTbrowse2.py
index 84cf8b8..211d09e 100644
--- a/Mac/Demo/PICTbrowse/PICTbrowse2.py
+++ b/Mac/Demo/PICTbrowse/PICTbrowse2.py
@@ -7,7 +7,6 @@ from Carbon import Qd
from Carbon import Win
from Carbon import Controls
from Carbon import List
-import sys
import struct
import macresource
diff --git a/Mac/Demo/PICTbrowse/cicnbrowse.py b/Mac/Demo/PICTbrowse/cicnbrowse.py
index d95e7c8..4bc7008 100644
--- a/Mac/Demo/PICTbrowse/cicnbrowse.py
+++ b/Mac/Demo/PICTbrowse/cicnbrowse.py
@@ -7,8 +7,6 @@ from Carbon import Qd
from Carbon import Win
from Carbon import Controls
from Carbon import List
-import sys
-import struct
from Carbon import Icn
import macresource
diff --git a/Mac/Demo/PICTbrowse/oldPICTbrowse.py b/Mac/Demo/PICTbrowse/oldPICTbrowse.py
index 2c6f08b..6ddd318 100644
--- a/Mac/Demo/PICTbrowse/oldPICTbrowse.py
+++ b/Mac/Demo/PICTbrowse/oldPICTbrowse.py
@@ -6,7 +6,6 @@ from Carbon import Res
from Carbon import Qd
from Carbon import Win
from Carbon import List
-import sys
import struct
import macresource
diff --git a/Mac/Demo/example1/dnslookup-1.py b/Mac/Demo/example1/dnslookup-1.py
index 2fb8dc4..6eb2c73 100644
--- a/Mac/Demo/example1/dnslookup-1.py
+++ b/Mac/Demo/example1/dnslookup-1.py
@@ -4,7 +4,6 @@ Res and Dlg in the process"""
import EasyDialogs
from Carbon import Res
from Carbon import Dlg
-import sys
import socket
import string
import macresource
diff --git a/Mac/Demo/example2/dnslookup-2.py b/Mac/Demo/example2/dnslookup-2.py
index 92cd181..fc3db66 100644
--- a/Mac/Demo/example2/dnslookup-2.py
+++ b/Mac/Demo/example2/dnslookup-2.py
@@ -2,7 +2,6 @@ import FrameWork
import EasyDialogs
from Carbon import Res
from Carbon import Dlg
-import sys
import socket
import string
import macresource
diff --git a/Mac/Demo/imgbrowse/imgbrowse.py b/Mac/Demo/imgbrowse/imgbrowse.py
index fddfc99..1dd8678 100644
--- a/Mac/Demo/imgbrowse/imgbrowse.py
+++ b/Mac/Demo/imgbrowse/imgbrowse.py
@@ -7,11 +7,9 @@ from Carbon import Qd
from Carbon import QuickDraw
from Carbon import Win
#ifrom Carbon mport List
-import sys
import struct
import img
import imgformat
-import struct
import mac_image
diff --git a/Mac/Demo/imgbrowse/mac_image.py b/Mac/Demo/imgbrowse/mac_image.py
index 75baff4..5930646 100644
--- a/Mac/Demo/imgbrowse/mac_image.py
+++ b/Mac/Demo/imgbrowse/mac_image.py
@@ -1,7 +1,6 @@
"""mac_image - Helper routines (hacks) for images"""
import imgformat
from Carbon import Qd
-import time
import struct
import MacOS
diff --git a/Mac/Modules/ae/aescan.py b/Mac/Modules/ae/aescan.py
index c23d18f..868b56e 100644
--- a/Mac/Modules/ae/aescan.py
+++ b/Mac/Modules/ae/aescan.py
@@ -3,8 +3,6 @@
# (Should learn how to tell the compiler to compile it as well.)
import sys
-import os
-import string
import MacOS
from bgenlocations import TOOLBOXDIR, BGENDIR
diff --git a/Mac/Modules/ah/ahscan.py b/Mac/Modules/ah/ahscan.py
index f52b771..e92d12f 100644
--- a/Mac/Modules/ah/ahscan.py
+++ b/Mac/Modules/ah/ahscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner_OSX
diff --git a/Mac/Modules/app/appscan.py b/Mac/Modules/app/appscan.py
index fa154ca..02ec13e 100644
--- a/Mac/Modules/app/appscan.py
+++ b/Mac/Modules/app/appscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/carbonevt/CarbonEvtscan.py b/Mac/Modules/carbonevt/CarbonEvtscan.py
index e29456f..9b5f023 100644
--- a/Mac/Modules/carbonevt/CarbonEvtscan.py
+++ b/Mac/Modules/carbonevt/CarbonEvtscan.py
@@ -1,8 +1,6 @@
# IBCarbonscan.py
import sys
-import os
-import string
import MacOS
import sys
diff --git a/Mac/Modules/cf/cfscan.py b/Mac/Modules/cf/cfscan.py
index 20751ae..de5bbba 100644
--- a/Mac/Modules/cf/cfscan.py
+++ b/Mac/Modules/cf/cfscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner_OSX
diff --git a/Mac/Modules/cg/cgscan.py b/Mac/Modules/cg/cgscan.py
index ba0ff2a..72aecee 100755
--- a/Mac/Modules/cg/cgscan.py
+++ b/Mac/Modules/cg/cgscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner_OSX
diff --git a/Mac/Modules/cm/cmscan.py b/Mac/Modules/cm/cmscan.py
index bbe0210..26cdb5e 100644
--- a/Mac/Modules/cm/cmscan.py
+++ b/Mac/Modules/cm/cmscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/ctl/ctlscan.py b/Mac/Modules/ctl/ctlscan.py
index 323ff9a..3150a2c 100644
--- a/Mac/Modules/ctl/ctlscan.py
+++ b/Mac/Modules/ctl/ctlscan.py
@@ -1,6 +1,5 @@
# Scan <Controls.h>, generating ctlgen.py.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
diff --git a/Mac/Modules/dlg/dlgscan.py b/Mac/Modules/dlg/dlgscan.py
index fbdbc50..d63cffd 100644
--- a/Mac/Modules/dlg/dlgscan.py
+++ b/Mac/Modules/dlg/dlgscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
diff --git a/Mac/Modules/drag/dragscan.py b/Mac/Modules/drag/dragscan.py
index b1aa6d5..cafdb5f 100644
--- a/Mac/Modules/drag/dragscan.py
+++ b/Mac/Modules/drag/dragscan.py
@@ -1,6 +1,5 @@
# Scan <Drag.h>, generating draggen.py.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR, INCLUDEDIR
sys.path.append(BGENDIR)
diff --git a/Mac/Modules/evt/evtscan.py b/Mac/Modules/evt/evtscan.py
index 8501f01..ddb158a 100644
--- a/Mac/Modules/evt/evtscan.py
+++ b/Mac/Modules/evt/evtscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/file/filescan.py b/Mac/Modules/file/filescan.py
index 574a9d6..d843a73 100644
--- a/Mac/Modules/file/filescan.py
+++ b/Mac/Modules/file/filescan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner_OSX
diff --git a/Mac/Modules/fm/fmscan.py b/Mac/Modules/fm/fmscan.py
index ec6c597..193afc7 100644
--- a/Mac/Modules/fm/fmscan.py
+++ b/Mac/Modules/fm/fmscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/folder/folderscan.py b/Mac/Modules/folder/folderscan.py
index 2630642..6345e49 100644
--- a/Mac/Modules/folder/folderscan.py
+++ b/Mac/Modules/folder/folderscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner_OSX
diff --git a/Mac/Modules/help/helpscan.py b/Mac/Modules/help/helpscan.py
index 7ad82e5..e928a5b 100644
--- a/Mac/Modules/help/helpscan.py
+++ b/Mac/Modules/help/helpscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/ibcarbon/IBCarbonscan.py b/Mac/Modules/ibcarbon/IBCarbonscan.py
index 9470dac..d39a770 100644
--- a/Mac/Modules/ibcarbon/IBCarbonscan.py
+++ b/Mac/Modules/ibcarbon/IBCarbonscan.py
@@ -1,8 +1,6 @@
# IBCarbonscan.py
import sys
-import os
-import string
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
diff --git a/Mac/Modules/icn/icnscan.py b/Mac/Modules/icn/icnscan.py
index 3ee357c..217fb03 100644
--- a/Mac/Modules/icn/icnscan.py
+++ b/Mac/Modules/icn/icnscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/launch/launchscan.py b/Mac/Modules/launch/launchscan.py
index 8d535fb..29adc12 100644
--- a/Mac/Modules/launch/launchscan.py
+++ b/Mac/Modules/launch/launchscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/list/listscan.py b/Mac/Modules/list/listscan.py
index 233ad5f..cc821af 100644
--- a/Mac/Modules/list/listscan.py
+++ b/Mac/Modules/list/listscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/menu/menuscan.py b/Mac/Modules/menu/menuscan.py
index bcd5019..e20775d 100644
--- a/Mac/Modules/menu/menuscan.py
+++ b/Mac/Modules/menu/menuscan.py
@@ -1,6 +1,5 @@
# Scan <Menus.h>, generating menugen.py.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
diff --git a/Mac/Modules/mlte/mltescan.py b/Mac/Modules/mlte/mltescan.py
index ee095ec..cb5665a 100644
--- a/Mac/Modules/mlte/mltescan.py
+++ b/Mac/Modules/mlte/mltescan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner_OSX
diff --git a/Mac/Modules/osa/osascan.py b/Mac/Modules/osa/osascan.py
index 085dd10..1bad43b 100644
--- a/Mac/Modules/osa/osascan.py
+++ b/Mac/Modules/osa/osascan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/qd/qdscan.py b/Mac/Modules/qd/qdscan.py
index 9c52f14..9617b24 100644
--- a/Mac/Modules/qd/qdscan.py
+++ b/Mac/Modules/qd/qdscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
diff --git a/Mac/Modules/qdoffs/qdoffsscan.py b/Mac/Modules/qdoffs/qdoffsscan.py
index a7bf518..a179a27 100644
--- a/Mac/Modules/qdoffs/qdoffsscan.py
+++ b/Mac/Modules/qdoffs/qdoffsscan.py
@@ -1,6 +1,5 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
diff --git a/Mac/Modules/qt/qtscan.py b/Mac/Modules/qt/qtscan.py
index 97a776b..0809e28 100644
--- a/Mac/Modules/qt/qtscan.py
+++ b/Mac/Modules/qt/qtscan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/res/resscan.py b/Mac/Modules/res/resscan.py
index 42f01e0..542d3ec 100644
--- a/Mac/Modules/res/resscan.py
+++ b/Mac/Modules/res/resscan.py
@@ -3,8 +3,6 @@
# (Should learn how to tell the compiler to compile it as well.)
import sys
-import os
-import string
import MacOS
from bgenlocations import TOOLBOXDIR, BGENDIR
diff --git a/Mac/Modules/scrap/scrapscan.py b/Mac/Modules/scrap/scrapscan.py
index 6239e92..0b977b6 100644
--- a/Mac/Modules/scrap/scrapscan.py
+++ b/Mac/Modules/scrap/scrapscan.py
@@ -4,7 +4,6 @@
# generates a boilerplate to be edited by hand.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/snd/sndscan.py b/Mac/Modules/snd/sndscan.py
index 4c4a226..03092ee 100644
--- a/Mac/Modules/snd/sndscan.py
+++ b/Mac/Modules/snd/sndscan.py
@@ -3,7 +3,6 @@
# (Should learn how to tell the compiler to compile it as well.)
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
diff --git a/Mac/Modules/te/tescan.py b/Mac/Modules/te/tescan.py
index 316b7fb..431006f 100644
--- a/Mac/Modules/te/tescan.py
+++ b/Mac/Modules/te/tescan.py
@@ -1,7 +1,6 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
diff --git a/Mac/Modules/win/winscan.py b/Mac/Modules/win/winscan.py
index 023c737..3727f2d 100644
--- a/Mac/Modules/win/winscan.py
+++ b/Mac/Modules/win/winscan.py
@@ -1,6 +1,5 @@
# Scan an Apple header file, generating a Python file of generator calls.
import sys
-import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
diff --git a/Misc/ACKS b/Misc/ACKS
index fa4175c..2ca01ca 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -277,6 +277,7 @@ Rycharde Hawkes
Jochen Hayek
Christian Heimes
Thomas Heller
+Malte Helmert
Lance Finn Helsten
Jonathan Hendry
James Henstridge
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index 112b749..6f2a868 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -100,9 +100,10 @@ syslog_syslog(PyObject * self, PyObject * args)
message = PyUnicode_AsString(message_object);
if (message == NULL)
return NULL;
+ Py_BEGIN_ALLOW_THREADS;
syslog(priority, "%s", message);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_END_ALLOW_THREADS;
+ Py_RETURN_NONE;
}
static PyObject *
diff --git a/PC/VS8.0/build_tkinter.py b/PC/VS8.0/build_tkinter.py
index defafe8..ea59039 100644
--- a/PC/VS8.0/build_tkinter.py
+++ b/PC/VS8.0/build_tkinter.py
@@ -7,7 +7,6 @@ Licensed to PSF under a Contributor Agreement.
import os
import sys
-import shutil
here = os.path.abspath(os.path.dirname(__file__))
par = os.path.pardir
diff --git a/PCbuild/build_tkinter.py b/PCbuild/build_tkinter.py
index 574d768..0590b0f 100644
--- a/PCbuild/build_tkinter.py
+++ b/PCbuild/build_tkinter.py
@@ -7,7 +7,6 @@ Licensed to PSF under a Contributor Agreement.
import os
import sys
-import shutil
here = os.path.abspath(os.path.dirname(__file__))
par = os.path.pardir
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 15a752f..df4a91d 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -4,7 +4,7 @@
# TO DO
# handle fields that have a type but no name
-import os, sys, traceback
+import os, sys
import asdl
diff --git a/Parser/spark.py b/Parser/spark.py
index 0fc6945..7772b6e 100644
--- a/Parser/spark.py
+++ b/Parser/spark.py
@@ -22,7 +22,6 @@
__version__ = 'SPARK-0.7 (pre-alpha-5)'
import re
-import sys
# Compatability with older pythons.
def output(string='', end='\n'):
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index c46176c..fc970d8 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -2,7 +2,7 @@
/*
- __version__ 57783.
+ __version__ 60978.
This module must be committed separately after each AST grammar change;
The __version__ number is set to the revision number of the commit
@@ -3171,7 +3171,7 @@ init_ast(void)
if (PyDict_SetItemString(d, "AST", (PyObject*)AST_type) < 0) return;
if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)
return;
- if (PyModule_AddStringConstant(m, "__version__", "57783") < 0)
+ if (PyModule_AddStringConstant(m, "__version__", "60978") < 0)
return;
if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return;
if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0)
diff --git a/Python/import.c b/Python/import.c
index 77fe168..22fc4ac 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -833,7 +833,7 @@ parse_source_module(const char *pathname, FILE *fp)
/* Helper to open a bytecode file for writing in exclusive mode */
static FILE *
-open_exclusive(char *filename)
+open_exclusive(char *filename, mode_t mode)
{
#if defined(O_EXCL)&&defined(O_CREAT)&&defined(O_WRONLY)&&defined(O_TRUNC)
/* Use O_EXCL to avoid a race condition when another process tries to
@@ -849,9 +849,9 @@ open_exclusive(char *filename)
|O_BINARY /* necessary for Windows */
#endif
#ifdef __VMS
- , 0666, "ctxt=bin", "shr=nil"
+ , mode, "ctxt=bin", "shr=nil"
#else
- , 0666
+ , mode
#endif
);
if (fd < 0)
@@ -870,11 +870,13 @@ open_exclusive(char *filename)
remove the file. */
static void
-write_compiled_module(PyCodeObject *co, char *cpathname, time_t mtime)
+write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
{
FILE *fp;
+ time_t mtime = srcstat->st_mtime;
+ mode_t mode = srcstat->st_mode;
- fp = open_exclusive(cpathname);
+ fp = open_exclusive(cpathname, mode);
if (fp == NULL) {
if (Py_VerboseFlag)
PySys_WriteStderr(
@@ -911,17 +913,16 @@ write_compiled_module(PyCodeObject *co, char *cpathname, time_t mtime)
static PyObject *
load_source_module(char *name, char *pathname, FILE *fp)
{
- time_t mtime;
+ struct stat st;
FILE *fpc;
char buf[MAXPATHLEN+1];
char *cpathname;
PyCodeObject *co;
PyObject *m;
-
- mtime = PyOS_GetLastModificationTime(pathname, fp);
- if (mtime == (time_t)(-1)) {
+
+ if (fstat(fileno(fp), &st) != 0) {
PyErr_Format(PyExc_RuntimeError,
- "unable to get modification time from '%s'",
+ "unable to get file status from '%s'",
pathname);
return NULL;
}
@@ -930,7 +931,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
in 4 bytes. This will be fine until sometime in the year 2038,
when a 4-byte signed time_t will overflow.
*/
- if (mtime >> 32) {
+ if (st.st_mtime >> 32) {
PyErr_SetString(PyExc_OverflowError,
"modification time overflows a 4 byte field");
return NULL;
@@ -939,7 +940,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
cpathname = make_compiled_pathname(pathname, buf,
(size_t)MAXPATHLEN + 1);
if (cpathname != NULL &&
- (fpc = check_compiled_module(pathname, mtime, cpathname))) {
+ (fpc = check_compiled_module(pathname, st.st_mtime, cpathname))) {
co = read_compiled_module(cpathname, fpc);
fclose(fpc);
if (co == NULL)
@@ -959,7 +960,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
if (cpathname) {
PyObject *ro = PySys_GetObject("dont_write_bytecode");
if (ro == NULL || !PyObject_IsTrue(ro))
- write_compiled_module(co, cpathname, mtime);
+ write_compiled_module(co, cpathname, &st);
}
}
m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, pathname);
diff --git a/Python/mystrtoul.c b/Python/mystrtoul.c
index c26111a..347f361 100644
--- a/Python/mystrtoul.c
+++ b/Python/mystrtoul.c
@@ -5,14 +5,6 @@
#define _SGI_MP_SOURCE
#endif
-/* Convert a possibly signed character to a nonnegative int */
-/* XXX This assumes characters are 8 bits wide */
-#ifdef __CHAR_UNSIGNED__
-#define Py_CHARMASK(c) (c)
-#else
-#define Py_CHARMASK(c) ((c) & 0xff)
-#endif
-
/* strtol and strtoul, renamed to avoid conflicts */
diff --git a/Tools/faqwiz/faqw.py b/Tools/faqwiz/faqw.py
index a14e335..d972f61 100755
--- a/Tools/faqwiz/faqw.py
+++ b/Tools/faqwiz/faqw.py
@@ -20,7 +20,7 @@ t1 = os.times() # If this doesn't work, just get rid of the timing code!
try:
FAQDIR = "/usr/people/guido/python/FAQ"
SRCDIR = "/usr/people/guido/python/src/Tools/faqwiz"
- import os, sys, time, operator
+ import os, sys
os.chdir(FAQDIR)
sys.path.insert(0, SRCDIR)
import faqwiz
diff --git a/Tools/modulator/Tkextra.py b/Tools/modulator/Tkextra.py
index f8e2ca2..b1051aa 100755
--- a/Tools/modulator/Tkextra.py
+++ b/Tools/modulator/Tkextra.py
@@ -218,7 +218,6 @@ def _go():
0, 'Save', 'Save as text'))
def _test():
- import sys
global mainWidget
mainWidget = Frame()
Pack.config(mainWidget)
diff --git a/Tools/pybench/systimes.py b/Tools/pybench/systimes.py
index fb3d3b5..cc880c5 100644
--- a/Tools/pybench/systimes.py
+++ b/Tools/pybench/systimes.py
@@ -31,7 +31,7 @@
the author. All Rights Reserved.
"""
-import time, sys, struct
+import time, sys
#
# Note: Please keep this module compatible to Python 1.5.2.
diff --git a/Tools/pynche/ChipViewer.py b/Tools/pynche/ChipViewer.py
index 05412ce..f59aa28 100644
--- a/Tools/pynche/ChipViewer.py
+++ b/Tools/pynche/ChipViewer.py
@@ -13,7 +13,6 @@ The ChipViewer class includes the entire lower left quandrant; i.e. both the
selected and nearest ChipWidgets.
"""
-from types import StringType
from Tkinter import *
import ColorDB
diff --git a/Tools/pynche/TypeinViewer.py b/Tools/pynche/TypeinViewer.py
index bcc3cda..d56c1b3 100644
--- a/Tools/pynche/TypeinViewer.py
+++ b/Tools/pynche/TypeinViewer.py
@@ -12,8 +12,6 @@ color selection will be made on every change to the text field. Otherwise,
you must hit Return or Tab to select the color.
"""
-import sys
-import re
from Tkinter import *
diff --git a/Tools/scripts/logmerge.py b/Tools/scripts/logmerge.py
index 8a9a11d..06750b0 100755
--- a/Tools/scripts/logmerge.py
+++ b/Tools/scripts/logmerge.py
@@ -34,7 +34,7 @@ XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7
from their output.
"""
-import os, sys, errno, getopt, re
+import sys, errno, getopt, re
sep1 = '='*77 + '\n' # file separator
sep2 = '-'*28 + '\n' # revision separator
diff --git a/Tools/scripts/nm2def.py b/Tools/scripts/nm2def.py
index 6887ee2..5f2bc8f 100755
--- a/Tools/scripts/nm2def.py
+++ b/Tools/scripts/nm2def.py
@@ -34,7 +34,7 @@ Even if this isn't the default output of your nm, there is generally an
option to produce this format (since it is the original v7 Unix format).
"""
-import os,re,sys
+import os, sys
PYTHONLIB = 'libpython'+sys.version[:3]+'.a'
PC_PYTHONLIB = 'Python'+sys.version[0]+sys.version[2]+'.dll'
diff --git a/Tools/scripts/pindent.py b/Tools/scripts/pindent.py
index 9f444f2..3ea1a52 100755
--- a/Tools/scripts/pindent.py
+++ b/Tools/scripts/pindent.py
@@ -81,7 +81,6 @@ STEPSIZE = 8
TABSIZE = 8
EXPANDTABS = 0
-import os
import re
import sys
diff --git a/Tools/scripts/pysource.py b/Tools/scripts/pysource.py
index 959deb0..05c2b86 100644
--- a/Tools/scripts/pysource.py
+++ b/Tools/scripts/pysource.py
@@ -20,7 +20,7 @@ __author__ = "Oleg Broytmann, Georg Brandl"
__all__ = ["has_python_ext", "looks_like_python", "can_be_compiled", "walk_python_files"]
-import sys, os, re
+import os, re
binary_re = re.compile('[\x00-\x08\x0E-\x1F\x7F]')
diff --git a/Tools/scripts/xxci.py b/Tools/scripts/xxci.py
index c1ebe5f..59da43a 100755
--- a/Tools/scripts/xxci.py
+++ b/Tools/scripts/xxci.py
@@ -7,7 +7,6 @@
import sys
import os
from stat import *
-import commands
import fnmatch
EXECMAGIC = '\001\140\000\010'
diff --git a/Tools/ssl/get-remote-certificate.py b/Tools/ssl/get-remote-certificate.py
index cbcd76f..b63428a 100644
--- a/Tools/ssl/get-remote-certificate.py
+++ b/Tools/ssl/get-remote-certificate.py
@@ -6,7 +6,7 @@
#
# By Bill Janssen.
-import sys, os
+import sys
def fetch_server_certificate (host, port):
diff --git a/Tools/unicode/gencodec.py b/Tools/unicode/gencodec.py
index a4d88e0..c63f559 100644
--- a/Tools/unicode/gencodec.py
+++ b/Tools/unicode/gencodec.py
@@ -26,7 +26,7 @@ Table generation:
"""#"
-import re, os, time, marshal, codecs
+import re, os, marshal, codecs
# Maximum allowed size of charmap tables
MAX_TABLE_SIZE = 8192
diff --git a/Tools/webchecker/wcgui.py b/Tools/webchecker/wcgui.py
index 9422df6..835d008 100755
--- a/Tools/webchecker/wcgui.py
+++ b/Tools/webchecker/wcgui.py
@@ -63,7 +63,6 @@ import getopt
from Tkinter import *
import tktools
import webchecker
-import random
# Override some for a weaker platform
if sys.platform == 'mac':
diff --git a/Tools/webchecker/wsgui.py b/Tools/webchecker/wsgui.py
index 0c851ca..95c7ab9 100755
--- a/Tools/webchecker/wsgui.py
+++ b/Tools/webchecker/wsgui.py
@@ -7,9 +7,7 @@ their respective text boxes, click GO or hit return, and presto.
"""
from Tkinter import *
-import Tkinter
import websucker
-import sys
import os
import threading
import Queue