]> granicus.if.org Git - python/commitdiff
Merged revisions 60990-61002 via svnmerge from
authorChristian Heimes <christian@cheimes.de>
Sat, 23 Feb 2008 18:30:17 +0000 (18:30 +0000)
committerChristian Heimes <christian@cheimes.de>
Sat, 23 Feb 2008 18:30:17 +0000 (18:30 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r60990 | eric.smith | 2008-02-23 17:05:26 +0100 (Sat, 23 Feb 2008) | 1 line

  Removed duplicate Py_CHARMASK define.  It's already defined in Python.h.
........
  r60991 | andrew.kuchling | 2008-02-23 17:23:05 +0100 (Sat, 23 Feb 2008) | 4 lines

  #1330538: Improve comparison of xmlrpclib.DateTime and datetime instances.
  Remove automatic handling of datetime.date and datetime.time.
  This breaks backward compatibility, but python-dev discussion was strongly
  against this automatic conversion; see the bug for a link.
........
  r60994 | andrew.kuchling | 2008-02-23 17:39:43 +0100 (Sat, 23 Feb 2008) | 1 line

  #835521: Add index entries for various pickle-protocol methods and attributes
........
  r60995 | andrew.kuchling | 2008-02-23 18:10:46 +0100 (Sat, 23 Feb 2008) | 2 lines

  #1433694: minidom's .normalize() failed to set .nextSibling for last element.
  Fix by Malte Helmert
........
  r61000 | christian.heimes | 2008-02-23 18:40:11 +0100 (Sat, 23 Feb 2008) | 1 line

  Patch #2167 from calvin: Remove unused imports
........
  r61001 | christian.heimes | 2008-02-23 18:42:31 +0100 (Sat, 23 Feb 2008) | 1 line

  Patch #1957: syslogmodule: Release GIL when calling syslog(3)
........
  r61002 | christian.heimes | 2008-02-23 18:52:07 +0100 (Sat, 23 Feb 2008) | 2 lines

  Issue #2051 and patch from Alexander Belopolsky:
  Permission for pyc and pyo files are inherited from the py file.
........

161 files changed:
Doc/library/pickle.rst
Doc/library/xmlrpclib.rst
Doc/whatsnew/2.6.rst
Lib/SimpleHTTPServer.py
Lib/ctypes/test/__init__.py
Lib/ctypes/test/test_checkretval.py
Lib/ctypes/test/test_find.py
Lib/ctypes/test/test_libc.py
Lib/ctypes/test/test_numbers.py
Lib/curses/wrapper.py
Lib/distutils/bcppcompiler.py
Lib/distutils/command/bdist_dumb.py
Lib/distutils/command/bdist_rpm.py
Lib/distutils/command/build_scripts.py
Lib/distutils/command/install.py
Lib/distutils/command/install_headers.py
Lib/distutils/command/register.py
Lib/distutils/filelist.py
Lib/distutils/tests/test_dist.py
Lib/distutils/tests/test_sysconfig.py
Lib/distutils/unixccompiler.py
Lib/email/base64mime.py
Lib/httplib.py
Lib/idlelib/MultiCall.py
Lib/idlelib/RemoteDebugger.py
Lib/idlelib/TreeWidget.py
Lib/idlelib/UndoDelegator.py
Lib/idlelib/keybindingDialog.py
Lib/idlelib/run.py
Lib/lib-tk/tkSimpleDialog.py
Lib/logging/handlers.py
Lib/ntpath.py
Lib/plat-mac/MiniAEFrame.py
Lib/plat-mac/aepack.py
Lib/plat-mac/bgenlocations.py
Lib/plat-mac/macostools.py
Lib/sqlite3/test/hooks.py
Lib/ssl.py
Lib/test/fork_wait.py
Lib/test/list_tests.py
Lib/test/seq_tests.py
Lib/test/test___all__.py
Lib/test/test_abc.py
Lib/test/test_applesingle.py
Lib/test/test_class.py
Lib/test/test_cmd.py
Lib/test/test_compare.py
Lib/test/test_copy.py
Lib/test/test_datetime.py
Lib/test/test_dbm.py
Lib/test/test_dis.py
Lib/test/test_dummy_threading.py
Lib/test/test_email.py
Lib/test/test_eof.py
Lib/test/test_extcall.py
Lib/test/test_fileinput.py
Lib/test/test_fractions.py
Lib/test/test_getargs2.py
Lib/test/test_gzip.py
Lib/test/test_htmlparser.py
Lib/test/test_httplib.py
Lib/test/test_imp.py
Lib/test/test_index.py
Lib/test/test_list.py
Lib/test/test_minidom.py
Lib/test/test_module.py
Lib/test/test_modulefinder.py
Lib/test/test_multibytecodec_support.py
Lib/test/test_optparse.py
Lib/test/test_ossaudiodev.py
Lib/test/test_pickle.py
Lib/test/test_pkg.py
Lib/test/test_plistlib.py
Lib/test/test_poll.py
Lib/test/test_posix.py
Lib/test/test_pyclbr.py
Lib/test/test_resource.py
Lib/test/test_rfc822.py
Lib/test/test_scriptpackages.py
Lib/test/test_sgmllib.py
Lib/test/test_site.py
Lib/test/test_socketserver.py
Lib/test/test_sqlite.py
Lib/test/test_strftime.py
Lib/test/test_support.py
Lib/test/test_tuple.py
Lib/test/test_unpack.py
Lib/test/test_urllib.py
Lib/test/test_urllib2.py
Lib/test/test_urllib2_localnet.py
Lib/test/test_userdict.py
Lib/test/test_userlist.py
Lib/test/test_userstring.py
Lib/test/test_whichdb.py
Lib/test/test_xml_etree.py
Lib/test/test_xml_etree_c.py
Lib/test/test_xmlrpc.py
Lib/xml/dom/minidom.py
Lib/xmlrpclib.py
Mac/Demo/PICTbrowse/ICONbrowse.py
Mac/Demo/PICTbrowse/PICTbrowse.py
Mac/Demo/PICTbrowse/PICTbrowse2.py
Mac/Demo/PICTbrowse/cicnbrowse.py
Mac/Demo/PICTbrowse/oldPICTbrowse.py
Mac/Demo/example1/dnslookup-1.py
Mac/Demo/example2/dnslookup-2.py
Mac/Demo/imgbrowse/imgbrowse.py
Mac/Demo/imgbrowse/mac_image.py
Mac/Modules/ae/aescan.py
Mac/Modules/ah/ahscan.py
Mac/Modules/app/appscan.py
Mac/Modules/carbonevt/CarbonEvtscan.py
Mac/Modules/cf/cfscan.py
Mac/Modules/cg/cgscan.py
Mac/Modules/cm/cmscan.py
Mac/Modules/ctl/ctlscan.py
Mac/Modules/dlg/dlgscan.py
Mac/Modules/drag/dragscan.py
Mac/Modules/evt/evtscan.py
Mac/Modules/file/filescan.py
Mac/Modules/fm/fmscan.py
Mac/Modules/folder/folderscan.py
Mac/Modules/help/helpscan.py
Mac/Modules/ibcarbon/IBCarbonscan.py
Mac/Modules/icn/icnscan.py
Mac/Modules/launch/launchscan.py
Mac/Modules/list/listscan.py
Mac/Modules/menu/menuscan.py
Mac/Modules/mlte/mltescan.py
Mac/Modules/osa/osascan.py
Mac/Modules/qd/qdscan.py
Mac/Modules/qdoffs/qdoffsscan.py
Mac/Modules/qt/qtscan.py
Mac/Modules/res/resscan.py
Mac/Modules/scrap/scrapscan.py
Mac/Modules/snd/sndscan.py
Mac/Modules/te/tescan.py
Mac/Modules/win/winscan.py
Misc/ACKS
Modules/syslogmodule.c
PC/VS8.0/build_tkinter.py
PCbuild/build_tkinter.py
Parser/asdl_c.py
Parser/spark.py
Python/Python-ast.c
Python/import.c
Python/mystrtoul.c
Tools/faqwiz/faqw.py
Tools/modulator/Tkextra.py
Tools/pybench/systimes.py
Tools/pynche/ChipViewer.py
Tools/pynche/TypeinViewer.py
Tools/scripts/logmerge.py
Tools/scripts/nm2def.py
Tools/scripts/pindent.py
Tools/scripts/pysource.py
Tools/scripts/xxci.py
Tools/ssl/get-remote-certificate.py
Tools/unicode/gencodec.py
Tools/webchecker/wcgui.py
Tools/webchecker/wsgui.py

index a9288e65eea6b2790e4402d1ee0907049c0dc8bc..33bd9c9b3f648255b737e252f7715d2b39046111 100644 (file)
@@ -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
index dd06c0a204c1b16f0164b4f579e3f3e3b90d0dc4..3f0bf3b5932f03d6015074aa2e1e38eb53d244f1 100644 (file)
@@ -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:
index 3f89c03fe8cb930d4c3f658ff2147e8a06399e77..a0ec071e281130d0e787db5668288b7319c0c015 100644 (file)
@@ -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
+
 .. ======================================================================
 
 
index eea3243a727e09ba3c5f0274ddd847ba02fbf6a2..deedd4b77221ac142c4b60edbb7d01a38fda4550 100644 (file)
@@ -14,7 +14,6 @@ import os
 import posixpath
 import BaseHTTPServer
 import urllib
-import urlparse
 import cgi
 import shutil
 import mimetypes
index 372c6e8c456f288d7b015f5c33075057fcdade4d..60b4975e090bb43eb7073c19177ae1c8f4e6494b 100644 (file)
@@ -1,4 +1,4 @@
-import glob, os, sys, unittest, getopt, time
+import os, sys, unittest, getopt, time
 
 use_resources = []
 
index 28be6c619f70c4a85d217802bce0cf6b070c4cd0..d15bd2efe614d0abf684dd1c4b68f64c4d90fa45 100644 (file)
@@ -1,5 +1,4 @@
 import unittest
-import sys
 
 from ctypes import *
 
index 9f61cdb3558092835cfd7ad6246a16fccf5ebc96..dc050933a1cb5e5c67f513f3af98f2ddef6e8a8f 100644 (file)
@@ -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
index 0e14c2f6dfbab5e69d591d48754ea10bfe5f674b..b204fae7fb565f71e701f50d8b67f1b6e80cc0da 100644 (file)
@@ -1,4 +1,3 @@
-import sys, os
 import unittest
 
 from ctypes import *
index 16e69cb24ce03c117d91c20eaf342c8b7de98560..c0732decd763c511d14d6db783278ec405d62088 100644 (file)
@@ -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_
index 53352041e9a62c0724e0338ace49877c69d920e7..9f1d86785dbf1bad2734bd14658a768045719772 100644 (file)
@@ -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,
index 1ab76c59817f6a9783ef90aafcf6c82796913988..c5e5cd25714fd62d8232157082681ff0024b9b67 100644 (file)
@@ -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
index f89961769c643b094004bd3323644d81b9b9be31..2d39922672c59c65ed37461b183a61c31b499464 100644 (file)
@@ -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
index 72f74f9c53008ee31df956a4d4f32c2c1e64fc60..83efb8e043b3ef143288e9ccb4daa2661b86913d 100644 (file)
@@ -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
index 7b44264cc22ac7e4519ee5ec9e94bd6c9f1d439d..3ac5b0c0be63949ee7a1e0a3fa352398dfd5d303 100644 (file)
@@ -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
index b768663c699834f7240051bde3d6270a5e3a1a4c..e4ee680271316e96193606285777bb3dc77ab513 100644 (file)
@@ -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 = {
index 7114eaf0683861b46b3b13c459b09c24123da513..346daaad0202cce5b2d99c3740dc446e23189a23 100644 (file)
@@ -5,7 +5,6 @@ files to the Python include directory."""
 
 __revision__ = "$Id$"
 
-import os
 from distutils.core import Command
 
 
index d123d327deab088b17a291020437f77f6d81c54b..40d9f20d1a12a7c5fd70a032fbe8876af139e8ab 100644 (file)
@@ -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
index 6506c30e6b7a0425a3b589d8269fdb8a86287151..8eab0a95bf8a67aaab6d9be793c2c564fa5fdac5 100644 (file)
@@ -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
index 23506b5daef3d4397fa8eb28e95e5512d0a4e4f0..91acf458059556526ec594f7fda1cf357292eb1d 100644 (file)
@@ -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
index 770b7c376fdfdfb17610fb05a3fb11dc8064b7e4..d56f7e9bc5269b5ebc913b5fb9b90c95e0a2914c 100644 (file)
@@ -2,7 +2,6 @@
 
 from distutils import sysconfig
 import os
-import sys
 import unittest
 
 from test.test_support import TESTFN
index ee975e15fab3586cd978474ff852c80cbbc4d979..25a042d075dce66700c3b8358e732f5395f849c6 100644 (file)
@@ -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
index cff558e80533441dd0c8a489ea965631307187f7..c60f8dbe253a2c525a483a29f3d84e8ab3b08d95 100644 (file)
@@ -35,7 +35,6 @@ __all__ = [
     'header_length',
     ]
 
-import re
 
 from base64 import b64encode
 from binascii import b2a_base64, a2b_base64
index bb873e47609eba3e8dc8ede41a22d9baf57eed84..638a92b039d1eead41edb9b5626ab787a573f182 100644 (file)
@@ -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
index c59ccfe57ac6bfabcd0d7145bca37a831a7e1e7a..f2e38879a0f39c6330288586b084c677f6fe4944 100644 (file)
@@ -30,7 +30,6 @@ Each function will be called at most once for each event.
 """
 
 import sys
-import os
 import re
 import Tkinter
 
index 46582d10ea7ff6ac40bd2a5a17abe1379f217627..d8662bbd96ebb3a6f926a6725315c6261f42ed7d 100644 (file)
@@ -20,7 +20,6 @@ barrier, in particular frame and traceback objects.
 
 """
 
-import sys
 import types
 from idlelib import rpc
 from idlelib import Debugger
index 0009de87638e39bedfa14ed41891084b7c69ecbf..04e16a24c8819161e2d6e355caed4e4238f55b1b 100644 (file)
@@ -15,7 +15,6 @@
 # - optimize tree redraw after expand of subnode
 
 import os
-import sys
 from Tkinter import *
 import imp
 
index cdda142e0b50f63ff8f78b6261b8df28f41ddb4c..57b02df9978d872218e5d50d82c85c7e2edf896b 100644 (file)
@@ -1,4 +1,3 @@
-import sys
 import string
 from Tkinter import *
 
index 7f4cc91c68d0404bcdf6023d1fff67d736aa48ec..f326b6f700ab7bba75e6a9fdc0c4a95cc3d83ec8 100644 (file)
@@ -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):
index 407e54309d02a725d451e7fabdc0e8b535b5c171..63880d6e76962695fd66376f8203c7dfd74cd078 100644 (file)
@@ -1,5 +1,4 @@
 import sys
-import os
 import linecache
 import time
 import socket
index f4ed77a044a2c2c8c6d4b0e52117d42d6fdb3756..573c3a386815d612d76118b041d4d956cd363012 100644 (file)
@@ -26,7 +26,6 @@ askstring -- get a string from the user
 '''
 
 from Tkinter import *
-import os
 
 class Dialog(Toplevel):
 
index 850e3bd58023b9a304e962133344e5c73dfc0b72..4645f3e512e172698d3eb24f18e0aaaf6e5d23f3 100644 (file)
@@ -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:
index c4a4ac5f70593cea8307a3df1f52f2807bf28ada..59f1402288b893fa831a48bc477a15637faed177 100644 (file)
@@ -6,8 +6,8 @@ module as os.path.
 """
 
 import os
-import stat
 import sys
+import stat
 import genericpath
 from genericpath import *
 
index eed7428aefabe583e9ece69dc6bcd2cb03a0c46f..e2f7cec3391b29204e887c771522c69b7011b78d 100644 (file)
@@ -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
index 5f8efd285103ab3a02a3cc104e93006477a9d048..b0301409dedea846359dd1b873e52d7f6687e6fb 100644 (file)
@@ -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)
index 041a6ffb27db7d9e66b8d0e662eae23fab910f2f..88e8f677640d16a5e91af8a8b2bd71e850d12b99 100644 (file)
@@ -5,7 +5,7 @@
 # but mac-style for MacPython, whether running on OS9 or OSX.
 #
 
-import sys, os
+import os
 
 Error = "bgenlocations.Error"
 #
index 67d32e74ce2ca60b3c376984c600dff926cdc366..80c372774b97f38b582ebf631943929f843491ae 100644 (file)
@@ -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:
index d67028fe71e37429765bc093e93d99eb29bb49b0..28f2404e0e09bbc8ac3ce2dfaf7397c5fe825e80 100644 (file)
@@ -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):
index c229cd3221fdeb65fd6c0d33f0a2468b6c4577fe..968f9a0075e456ab6e10f0eb61dccd453a7ce903 100644 (file)
@@ -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
 
index 38e2b4f76afd932622e320c5da87510ff764265f..678e3c4ded9a648a183170952199c8d2162b5afc 100644 (file)
@@ -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
index 49283e49fca18a7937962eb4d9d52cc476799027..4ffa6684e6535384c4e268843b47168d529ac426 100644 (file)
@@ -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):
index 81fe62709ff28193e7a22aa1b3457f09c59dcf7a..a3815e216e841054f85c8f99411c91ec61cdea07 100644 (file)
@@ -3,7 +3,6 @@ Tests common to tuple, list and UserList.UserList
 """
 
 import unittest
-from test import test_support
 import sys
 
 # Various iterables
index 6e844e7b4b7ed8b43f725af6fe2f9f01334551ad..a2a251909ac8ad85a666c8106e80f3093c02bb1f 100644 (file)
@@ -1,5 +1,5 @@
 import unittest
-from test.test_support import verbose, run_unittest
+from test.test_support import run_unittest
 import sys
 
 
index 80b0123c4bb98f73d1bb8e13e2f1e47e6c8da317..7a932fcf30987f6517fdc460def97c70c7285df0 100644 (file)
@@ -3,7 +3,6 @@
 
 """Unit tests for abc.py."""
 
-import sys
 import unittest
 from test import test_support
 
index 96450e352fa5820e0aae632b4bdb720322730036..9dfcb196deb2e53c67d00905fd708b1c148b3350 100644 (file)
@@ -5,7 +5,6 @@ import macostools
 import Carbon.File
 import MacOS
 import os
-import sys
 from test import test_support
 import struct
 import applesingle
index ab44a4cb3cd3e827b36acf54621e641af2db7e5b..730826db8652fb41811ecaa53939281048e3f09f 100644 (file)
@@ -1,7 +1,6 @@
 "Test the functionality of Python classes implementing operators."
 
 import unittest
-import sys
 
 from test import test_support
 
index 3ed6322c95df118d0790e13a3fd629af5b877961..2c77931071c66588a86a4eb40e772739b223443b 100644 (file)
@@ -5,7 +5,6 @@ Original by Michael Schneider
 """
 
 
-from test import test_support
 import cmd
 import sys
 import trace
index 15fe3c20222fb0b3bb17f8553b2919e48a4351c8..de32f3cc403f1b431846f67e03de7e5fac182969 100644 (file)
@@ -1,4 +1,3 @@
-import sys
 import unittest
 from test import test_support
 
index cf945939c97cc03750c10dd756b201e8c3a1de31..8b50e4712780a9cc574611a64b12f9441d96a4fa 100644 (file)
@@ -1,6 +1,5 @@
 """Unit tests for the copy module."""
 
-import sys
 import copy
 import copy_reg
 
index 8ac71607b8fe2ae833e6169dd81f783886b396f7..e768a9c7b4ee148b3d446a98d9ce36aeb8868af5 100644 (file)
@@ -4,7 +4,6 @@ See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases
 """
 
 import os
-import sys
 import pickle
 import unittest
 
index 806125f70d7f0ab136ab58e8c6982ff7d229d09f..4c97a4ce0838cd71dc22083cdde3dbf071a356b2 100755 (executable)
@@ -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
index f1357805dcdda6ecbfd4f4c0c7c226910c9b11ed..ceb7509825c5fa858e7f26ffe0bd2d09581bb5d8 100644 (file)
@@ -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
index 90bf6e0ee91f1bae1d91b66502f3cf7b65b00ae9..6f1624149271eece83152ee6ec5509be4d4acff5 100644 (file)
@@ -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
 
index 736c393062dca814d1d835d1a504aae1153c48ff..e12cbd36f415982e870db922551cbfc4f25fc076 100644 (file)
@@ -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
index 1187d077fd934c97a1299219fe9ce28b84657a59..4284d11d08698a0ceed34c2c33ba73c38b63bf40 100644 (file)
@@ -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
 
index 596a3ef87f49f43392bb71679f929e5ea8b0f621..bad144004ee61968a87d71267b70fae867a0601d 100644 (file)
@@ -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):
index 2ba3bc3c3a3c9d2939836215ca56b19c5f8b01f5..aa3852755fd095ddc50472acbe522f60893e5a32 100644 (file)
@@ -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
 
index dacb58796ce77801e913f6e1c51e93a49bf8f97c..21c176107c4081be28e169240e651c08e31da0f4 100644 (file)
@@ -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
index 9172576b40ecbee4e5e9f2bc7d1b10f05ffb0075..4253141dbd653b5183012370414744ec363adbd9 100644 (file)
@@ -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",
index 31000df3171df461ea07f484d3fdf08d92d2a4ae..08f7f3feefd8d5d69c8e0ab1fb47a82ff6e8887c 100644 (file)
@@ -4,7 +4,7 @@
 
 import unittest
 from test import test_support
-import sys, os
+import os
 import gzip
 
 
index b408a18f704a53f724b2811f74cd8ace22fd19a7..a4f2c34c6cefa448045af21e5992f96eef6bcb6f 100755 (executable)
@@ -2,7 +2,6 @@
 
 import HTMLParser
 import pprint
-import sys
 import unittest
 from test import test_support
 
index 7e5a8a5c950a65e8010cdb250c07b3a59590cf29..4caf9960cce0c5e4d1fdec4d73f15e8628e50a4d 100644 (file)
@@ -1,6 +1,5 @@
 import httplib
 import io
-import sys
 import socket
 
 from unittest import TestCase
index 3b0a13d9e551c2ec75b6ddb42c2eb090158130a8..13a3bfd713723cf1faf4640bc3cc963817a7614d 100644 (file)
@@ -1,5 +1,4 @@
 import imp
-import thread
 import unittest
 from test import test_support
 
index 9a22020d9fa078f47d2b90deb1e604d054392828..71cfb15c0f10ad337fe9eb4564a9a3b752a275eb 100644 (file)
@@ -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
 
index 5b84a42a76a72a5e16ed9e4203777a731beb7327..b3b2195071cbdaa2cc4ab82b28f191fdde466dee 100644 (file)
@@ -1,4 +1,3 @@
-import unittest
 import sys
 from test import test_support, list_tests
 
index d1a72bd5ecdc1a275d5f474e69f60a2e2a8d72d0..9ea60a9cea93dd465ec9aa75109f422b62759b91 100644 (file)
@@ -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
index d091c6b1107113856131de14f1d6170df9907071..35c765ecc861cac7272b0f45ff6078f9931548a6 100644 (file)
@@ -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)
index 3bc22ab59ef120d0667e3d3614ca47787ed802e1..80c06d7c30d18d5220e1987880cf4d89ac306603 100644 (file)
@@ -1,5 +1,5 @@
 import __future__
-import sys, os
+import os
 import unittest
 import distutils.dir_util
 import tempfile
index 6b67057265088901481b86b0a8abc2274d8d5200..42df9d7863aaf799cd151b9362e8271b184afdbb 100644 (file)
@@ -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
index 1cfdd50e55862cae950a1f1f6f42de17952f9f83..71de8695db2457e83980ce4d1ab8552bc76f7728 100644 (file)
@@ -15,7 +15,6 @@ import copy
 import unittest
 
 from io import StringIO
-from pprint import pprint
 from test import test_support
 
 
index 97d598912fe4de3d433a10ff5b3e6be749d65519..8f9bf6f1a6c8729a9eef5b31cbf7884f8094909d 100644 (file)
@@ -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
index f54381fa54bfdf2719b48efa87eda1bff1472e76..aa09a6a5cd1e55f2b0e0f7a34f3a9f9fd56c7387 100644 (file)
@@ -1,5 +1,4 @@
 import pickle
-import unittest
 import io
 
 from test import test_support
index 630956df0ed3212157c92fafb53ae50d437a879e..dcc7433176f410e87c24e4705d547a0cd6a87d27 100644 (file)
@@ -4,7 +4,6 @@ import sys
 import os
 import tempfile
 import textwrap
-import traceback
 import unittest
 from test import test_support
 
index 5c6a059015165b76a6012458571dfca577dccb60..883b01f6cfc1c19ded5dae5e20da774b3b30c463 100644 (file)
@@ -3,7 +3,6 @@
 import unittest
 import plistlib
 import os
-import time
 import datetime
 from test import test_support
 
index a6110e623f25e0289662e9861cc07c6e18e06956..cd9bfb02bd509936626f23c4d43391452d65f236 100644 (file)
@@ -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:
index efd5fb07488fcf60fbf103d9fecfc051b6cc9f9b..13f8f9eed66db6c0f93398ced840e9d54dea988a 100644 (file)
@@ -9,7 +9,6 @@ except ImportError:
 
 import time
 import os
-import sys
 import unittest
 import warnings
 warnings.filterwarnings('ignore', '.* potential security risk .*',
index f041823864a505336c6407c7ff0dd1f77b88f16b..c96ae6d046d844d3bc8b2c0f1cd20ed379a2123a 100644 (file)
@@ -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
index 86440b50b2cf1eeee103b6d146c3b30193e9df87..b66caf81a384d4b3607ce90a4596256a54ae24d8 100644 (file)
@@ -1,7 +1,6 @@
 import unittest
 from test import test_support
 
-import os
 import resource
 import time
 
index b563c9cd988377924be2fc16c293f09330f222d0..1f5dd64190b5791bfdf8f0638041c640b371e169 100644 (file)
@@ -1,5 +1,4 @@
 import rfc822
-import sys
 import unittest
 from test import test_support
 
index a2e03f91e6c883d65859629c8ab1ee417b413d72..ee14be2bb4b1c261a9a3866efd6708c1ca35760e 100644 (file)
@@ -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
 
index f0f8ad6d322f6b56e66252e52dfaf349254f918c..374b92130083eab434122bf3ab1d302d501a87fd 100644 (file)
@@ -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:
index 4624ea6276c0642a86080b08d59f7285dada8e86..b80d6e699522960e14416b6d7313fa940f51ce7d 100644 (file)
@@ -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.
index 0fccdd935b650d1d96e89c0b31e4a6ce7a15186d..69f0b536a61ca4c6e5adea84960c728cb04513f5 100644 (file)
@@ -9,7 +9,6 @@ import imp
 import select
 import time
 import threading
-from functools import wraps
 import unittest
 import SocketServer
 
index f033772df6ca4fbcb407193086de642221ca8db0..c1523e11ba3522d78f828143c8969c1edd843eaf 100644 (file)
@@ -1,5 +1,4 @@
 from test.test_support import run_unittest, TestSkipped
-import unittest
 
 try:
     import _sqlite3
index c6db3dd00c45b7ec398c4b223ba03065ae6b8cf1..0870134d1f432ca8e5a03fd67cbe243bb113a8ab 100755 (executable)
@@ -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():
index 0fd5d88547f0676cdd216dbcfde713a7dea5c06b..ba36448ec8ad14713c49a1cf6eba6138ed93ecf1 100644 (file)
@@ -10,7 +10,6 @@ import sys
 import os
 import os.path
 import warnings
-import types
 import unittest
 
 class Error(Exception):
index 1da0ef35d850d5b8b72eabd6e60e5c8721ebc4db..62c5d717029c4a4a4123f8ee0850a81e865175a7 100644 (file)
@@ -1,4 +1,3 @@
-import unittest
 from test import test_support, seq_tests
 
 class TupleTest(seq_tests.CommonTest):
index 75033ed4805fbba8d95fa4d7a607d82d1c6c1266..a90b5e5c18e631c793bf5f11b5a3d8a199b13bdd 100644 (file)
@@ -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)
index c233e3560f616787afeff024bc93aa136984ca2a..d58414cf25397a1c79a4d35086305c3c16cd2c59 100644 (file)
@@ -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"""
index 199119a08ef36ec999d4f4cf21c2eb74398ad322..6ceec06f9493abe3d23f41550901cd3742e05001 100644 (file)
@@ -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
index f0b5dea32365b11448ff070d95d41ccc132aa767..663330ba93faf31b27fe7fecade8f4560727e5d8 100644 (file)
@@ -1,6 +1,5 @@
 #!/usr/bin/env python
 
-import sys
 import threading
 import urlparse
 import urllib2
index 643caf9def1f8eccf8b5d3096f41c1bb8e1fd177..3a8a8b4925db724d66031aa458893219986890bf 100644 (file)
@@ -1,6 +1,5 @@
 # Check every path through every method of UserDict
 
-import unittest
 from test import test_support, mapping_tests
 import collections
 
index 9d012e054ce692ef56c15d5ea0c8ee5daac5b15f..a0daa4e8ede3ad81587d309ee71016a41d6e803c 100644 (file)
@@ -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):
index a0fefc3672017bd6e833f2bd11af5b8d06ffd50f..e8fb13507ba8a027678dbdef1f5185e4ecb76297 100755 (executable)
@@ -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
 
index 7746329899927b8acad5ddbc6674cf117321e440..e63eb0fe769a38fc1503894de7a7d7c149e9e29b 100644 (file)
@@ -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
 
index 1a6b7f33bc8d7b2885c9b6329c704f13d552faf9..84705841e079cd13e0038d24dd7b28a9b555d446 100644 (file)
@@ -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
 
index c8eec40bece3310fffdcbacfa33bf2ff8ea273e0..80e91d14afe45dee6726d6de9137ab01a1f19091 100644 (file)
@@ -1,6 +1,7 @@
 # xml.etree test for cElementTree
 
-import doctest, sys
+import doctest
+import sys
 
 from test import test_support
 
index 092be51a71cfaa9f19f342006b10262a408c892d..083653383f209efa4dee85c17dcfedc464d1eb02 100644 (file)
@@ -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)
index 3087a5cec8e7248196f8fe0416aa3be5ccb461a6..b6f0a862421356333a975595cdbe26a116d5f438 100644 (file)
@@ -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):
index da96420311623db922ae1d0174f18bb6d12a15e8..2e68a1b33a1faab75fa2a925e44a1adafb6316b0 100644 (file)
@@ -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:
index 701ef7f57fc0328d171b8fde6b7d0cb7da643212..f55070bf53eb2223f86395f9f4cf2d3b9772d3ac 100644 (file)
@@ -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
 
index 83f431ecc5ee50d871bb13835ab542793ab09194..e2bc87bf9dc9a008af7cc261bf92adc5cd2769b5 100644 (file)
@@ -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
 
index 84cf8b8107cf4605a0600a54d0a5d5ee6e17fc5d..211d09e602e4aa9672df80e74aed08f16e6f0e1b 100644 (file)
@@ -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
 
index d95e7c869a7d693ecdab492be84c5a1c2ea6e978..4bc7008ed46f1047fceeb76af8535718b4f74521 100644 (file)
@@ -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
 
index 2c6f08b586475c8d0392ec41c23ed0bf833232b9..6ddd318e6522a059d8fd73d4680fdbacac117d33 100644 (file)
@@ -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
 
index 2fb8dc4405d811e6c1471776cd41ed6a43ee44a4..6eb2c73f736ad8704773d219b05569c838c2c0ae 100644 (file)
@@ -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
index 92cd181af5bd629c42dd35a81f5dbe899b33ee9a..fc3db668cce97c7b70969fdc5a5fab1aef45e124 100644 (file)
@@ -2,7 +2,6 @@ import FrameWork
 import EasyDialogs
 from Carbon import Res
 from Carbon import Dlg
-import sys
 import socket
 import string
 import macresource
index fddfc999a053d61609b29f48a9a6c7401c273436..1dd86788d1539a943a08e6fa4a8821ccd6f53fd5 100644 (file)
@@ -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
 
 
index 75baff438e4c77b221e2192fa54ba363c95df9b1..59306460feab7c9715d80e24d3be0a9f67a9a8a9 100644 (file)
@@ -1,7 +1,6 @@
 """mac_image - Helper routines (hacks) for images"""
 import imgformat
 from Carbon import Qd
-import time
 import struct
 import MacOS
 
index c23d18f8756f649ce534a74281f909e5a7760e64..868b56ec131e6c7c02731aa9ac6b11bf13b308cd 100644 (file)
@@ -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
index f52b7716b0dc48298182247de0101c967144ee29..e92d12f344414cb65702b9da0c1c97c42acc08c8 100644 (file)
@@ -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
index fa154ca234f4000672f6afdb40d8b222b99407b3..02ec13e7957a98a6c3bf908ba619f28f8f16dd87 100644 (file)
@@ -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
index e29456f67e839f5cd998ec52b3f8648ab60fb6ff..9b5f023899942336e57efad041e77ef9088c18cc 100644 (file)
@@ -1,8 +1,6 @@
 # IBCarbonscan.py
 
 import sys
-import os
-import string
 import MacOS
 import sys
 
index 20751aeda89ae4ef43c8b1cac1f0a692f0c4e5e0..de5bbba2b8aa61c7d0b23875d6e7917e680b1d33 100644 (file)
@@ -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
index ba0ff2a1ef23e2a9ee4df9c1fb1d90cc538cc2b1..72aecee800cee51bf18cc4fd41094c582fb9b738 100755 (executable)
@@ -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
index bbe021051282d57263f7347376f8b7500b82b66c..26cdb5efa6c651159997038fe2efcde3a010a9e2 100644 (file)
@@ -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
index 323ff9a1e37165b901a1a981a1f97d85f1864f44..3150a2cf5a57a0add724151f674da273181743ae 100644 (file)
@@ -1,6 +1,5 @@
 # Scan <Controls.h>, generating ctlgen.py.
 import sys
-import os
 from bgenlocations import TOOLBOXDIR, BGENDIR
 sys.path.append(BGENDIR)
 
index fbdbc50612705688ea7eea49ee64945d1d5eb4fb..d63cffd254d773783a5407a76063dd7c0a6ca216 100644 (file)
@@ -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)
 
index b1aa6d58446f430d30d651ef42465d6b121ef277..cafdb5fea650c0ddcf1a36341d03bb4b5e37281d 100644 (file)
@@ -1,6 +1,5 @@
 # Scan <Drag.h>, generating draggen.py.
 import sys
-import os
 from bgenlocations import TOOLBOXDIR, BGENDIR, INCLUDEDIR
 sys.path.append(BGENDIR)
 
index 8501f013943f1a7a24ecbc3ce4795d65c04ed85c..ddb158adf536e20324633e1423c760958e37ce28 100644 (file)
@@ -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
index 574a9d6e5ab59fa2afe15567cdbdaf1ff558b5c2..d843a7373ef4f104355647d361885a48fd0d4de0 100644 (file)
@@ -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
index ec6c597c4f09b53ff02552fc46a1c5890e72ebae..193afc7b5ce1bed674fb3b62fe3c697dc7d0d3e0 100644 (file)
@@ -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
index 26306420fd89252c05481d1282697e2867c9df01..6345e4983f694915bf8d701f7fa9682abf92137b 100644 (file)
@@ -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
index 7ad82e512be54299e016ffef67355047ab29fab5..e928a5bbdb1ed107d225f86c472485f6f5ae6d5d 100644 (file)
@@ -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
index 9470dacba0242c7038456dc29e61686698e28fb9..d39a7706ef7a0e714cf1775beedd2659088400b1 100644 (file)
@@ -1,8 +1,6 @@
 # IBCarbonscan.py
 
 import sys
-import os
-import string
 
 from bgenlocations import TOOLBOXDIR, BGENDIR
 sys.path.append(BGENDIR)
index 3ee357c09e67f9582da091698325ac180a532c04..217fb03395b775f00b18f693f581f837c11930f5 100644 (file)
@@ -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
index 8d535fb15749c95aba52d71118b9fcb1565327e9..29adc120ef44e4a257bb18243430bd1f71dcc1d1 100644 (file)
@@ -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
index 233ad5fe8d4da519dabdb15faf3c96e0259ed5d1..cc821afda9b5e0e8528d4bbd2665e46d517c647a 100644 (file)
@@ -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
index bcd50192e41f3f94c6003ddb629f6596bae81538..e20775d62f224daa394fb26adf53c14087b33f4e 100644 (file)
@@ -1,6 +1,5 @@
 # Scan <Menus.h>, generating menugen.py.
 import sys
-import os
 from bgenlocations import TOOLBOXDIR, BGENDIR
 sys.path.append(BGENDIR)
 
index ee095ecd8e26ffdbbdbe2d017383b429a5d05999..cb5665ac4556a8f492f85a411d7082b50ed8e57d 100644 (file)
@@ -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
index 085dd1083204a8e14867888ed9bb042e13f45ac6..1bad43bc0a0ca04c0747b351662b2b07c170c544 100644 (file)
@@ -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
index 9c52f14cbefab3bc9289d23e76ca8a44af6dce3d..9617b246e5c214cc448accddcde8f0c3c11f087b 100644 (file)
@@ -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)
 
index a7bf518bdc448f386f83ebdd59f671b5c3b5bd08..a179a278dad37a3b8038fe4088397ffb474f8b8a 100644 (file)
@@ -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)
 
index 97a776b2c80e3851ac355c84753f7b116242ef68..0809e28af9ba9db805df42e2b6d7142ea96b1c45 100644 (file)
@@ -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
index 42f01e0f882dddcbf18ef40cf1d31c6364915c9e..542d3ec0d8d29ee0880ee348164e6e3d946e38c1 100644 (file)
@@ -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
index 6239e92fdcec3a56d64ff7f63d215ffb4db32e0c..0b977b67e6ad9751745143268a3a3a105281a7fb 100644 (file)
@@ -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
index 4c4a2268fbaee591cb2d68bdf07460f91bf1aadd..03092ee5203251f25b37f8330d4f76c55f81dcdb 100644 (file)
@@ -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)
 
index 316b7fbc2af0ebbd619a3dc06230188a393ae018..431006fe90b854af5f27561dcfc2d90d010d8774 100644 (file)
@@ -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
index 023c73745222695373246b80f560d1074466d3ce..3727f2dea997e54a7e2ab890825b9fb375e51c00 100644 (file)
@@ -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)
 
index fa4175c48b0488c605170c8bfd8331e7c896bc0e..2ca01ca056b2f4f6cef021f9956b51caabeea1c5 100644 (file)
--- 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
index 112b7493ed7fcb00c9156240f2e3aa9f390a1642..6f2a8683e83713a7e06dcb7ede96513581cf6c26 100644 (file)
@@ -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 * 
index defafe81537f4b75dc73fa5e204152e834067b16..ea59039b97a64fee977259ce8628befb1810cd4b 100644 (file)
@@ -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
index 574d76808611f4a305c0a840848d25d32c682d88..0590b0f282ec449a807741fe6410b5c52ebccfe7 100644 (file)
@@ -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
index 15a752fcdbbb93437819fa4d411e289134de4392..df4a91db44814349de3ae13e10f674214e2ca495 100755 (executable)
@@ -4,7 +4,7 @@
 # TO DO
 # handle fields that have a type but no name
 
-import os, sys, traceback
+import os, sys
 
 import asdl
 
index 0fc6945b5c26de34b30db2fa2f3878a52d4d9e74..7772b6e0ee46389775e7751357883d5983800814 100644 (file)
@@ -22,7 +22,6 @@
 __version__ = 'SPARK-0.7 (pre-alpha-5)'
 
 import re
-import sys
 
 # Compatability with older pythons.
 def output(string='', end='\n'):
index c46176cb6aba7f7c81f47a6f780856682422b62d..fc970d8970bbe4d317914cec1abb4b4bebd3b8f7 100644 (file)
@@ -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)
index 77fe168f4f442278ec50bb07e5087f9877b3b130..22fc4ac7dd2c47a241a78943076218660e489a57 100644 (file)
@@ -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);
index c26111a9d5b3a5fe9edf5176447bfa60d74fb461..347f361e03f6d3242012b49a5894ad7a6b3415da 100644 (file)
@@ -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 */
 
 
index a14e33540eaebe31381f378dbb26162b37ed529c..d972f61e058ecdf978cf4371bcb198fa64e3900b 100755 (executable)
@@ -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
index f8e2ca2c82d95a9c182d66a851f15f8fbb747ce1..b1051aacff0123ff8100090261935b9ad58b336a 100755 (executable)
@@ -218,7 +218,6 @@ def _go():
                   0, 'Save', 'Save as text'))
 
 def _test():
-    import sys
     global mainWidget
     mainWidget = Frame()
     Pack.config(mainWidget)
index fb3d3b59fb966c937a81287e75a8ef6d793ef967..cc880c56781a6cf6aa52c011b5b9d379e2d1b5d5 100644 (file)
@@ -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.
index 05412cec48bb9d139d1eb38fe6f59dd95060d203..f59aa2819fa8da1418b5b7556f111bfe6b81bd9d 100644 (file)
@@ -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
 
index bcc3cda8662af19ae0a00ca9acc846e29aaeaf56..d56c1b32c09f7bf61f887d14634714f1ccead0fc 100644 (file)
@@ -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 *
 
 
index 8a9a11d18272aae34413722bdb9d7e67c5caf8ce..06750b0c2b7bd12391ecb504ff61797c627ea22c 100755 (executable)
@@ -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
index 6887ee282d43a198289af0fa802166c353553212..5f2bc8fc781e94fc79341c1986c3b247b4e1e7ab 100755 (executable)
@@ -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'
index 9f444f2d2a6a4305fb08cd5865fcbda2eaebf1ac..3ea1a529260dd0c086d03cfe8dfaf9f6f4d52725 100755 (executable)
@@ -81,7 +81,6 @@ STEPSIZE = 8
 TABSIZE = 8
 EXPANDTABS = 0
 
-import os
 import re
 import sys
 
index 959deb0b7c2ca15abac37d2ccc282411a19a5ab6..05c2b8667f05e68e63fe081bd25e804cc1031e0e 100644 (file)
@@ -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]')
 
index c1ebe5f1d860f6c3dcac413c3a829d223f136088..59da43aec5f93990d6db5e09cc1c96f8536e2943 100755 (executable)
@@ -7,7 +7,6 @@
 import sys
 import os
 from stat import *
-import commands
 import fnmatch
 
 EXECMAGIC = '\001\140\000\010'
index cbcd76f421746fd07a700bdabe5e627167339d00..b63428abd4a9423144b2d80cb49afbda9cdfc788 100644 (file)
@@ -6,7 +6,7 @@
 #
 # By Bill Janssen.
 
-import sys, os
+import sys
 
 def fetch_server_certificate (host, port):
 
index a4d88e0799dde1cec0eebb410ec482656c4e42f9..c63f559c1fa9c64912f7b3cc44c573f33fbb400b 100644 (file)
@@ -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
index 9422df6cb099b26e2d6184cff7b454688ae913ab..835d00834bacaf8b7be2dfbe937448d8751e1ef9 100755 (executable)
@@ -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':
index 0c851ca5db3e777278fdebb57fb072ab3db02cb2..95c7ab9e1d7eceed8735952a88823641b62ef383 100755 (executable)
@@ -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