Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Doc/includes/email-headers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Import the email modules we'll need
from email.parser import BytesParser, Parser
from email.parser import Parser
from email.policy import default

# If the e-mail headers are in a file, uncomment these two lines:
# If the e-mail headers are in a file, uncomment these three lines:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let email experts to review this change.

# from email.parser import BytesParser
# with open(messagefile, 'rb') as fp:
# headers = BytesParser(policy=default).parse(fp)

Expand Down
2 changes: 1 addition & 1 deletion Doc/includes/tzinfo_examples.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import tzinfo, timedelta, datetime, timezone
from datetime import tzinfo, timedelta, datetime

ZERO = timedelta(0)
HOUR = timedelta(hours=1)
Expand Down
1 change: 0 additions & 1 deletion Lib/asyncio/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import concurrent.futures
import logging
import sys
import traceback

from . import base_futures
from . import events
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from distutils.spawn import spawn
from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_pairwise, newer_group
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function used at all? In any case left this on distutils experts. This is very old and stable code. Maybe it is a bug that newer_pairwise is not used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's part of the public API:
https://docs.python.org/dev/distutils/apiref.html#distutils.dep_util.newer_pairwise

This is very old and stable code. Maybe it is a bug that newer_pairwise is not used.

An unused import is a bug, I don't think that not using a function is a bug :-) The code uses newer_group().

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but maybe newer_pairwise() should be used instead of newer_group(). Or there is a typo in the name of newer_pairwise, and this is why it can't be searched in the code. Let distutils experts to review this change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but maybe newer_pairwise() should be used instead of newer_group(). Or there is a typo in the name of newer_pairwise, and this is why it can't be searched in the code. Let distutils experts to review this change.

I looked at the code, and I don't see how it could be a "typo". newer_pairwise() expects a list of objects in the second argument, whereas newer_group() expects a single "target" as the second argument. The code looks perfectly fine:

    def _need_link(self, objects, output_file):
        """Return true if we need to relink the files listed in 'objects'
        to recreate 'output_file'.
        """
        if self.force:
            return True
        else:
            if self.dry_run:
                newer = newer_group (objects, output_file, missing='newer')
            else:
                newer = newer_group (objects, output_file)
            return newer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good.

(In any case, if it was a mistake to use newer_group, the mistake has been here for a long time.
Changing it would need its own ticket.)

from distutils.dep_util import newer_group
from distutils.util import split_quoted, execute
from distutils import log

Expand Down
1 change: 0 additions & 1 deletion Lib/distutils/command/bdist_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import subprocess, sys, os
from distutils.core import Command
from distutils.debug import DEBUG
from distutils.util import get_platform
from distutils.file_util import write_file
from distutils.errors import *
from distutils.sysconfig import get_python_version
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/command/bdist_wininst.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import sys, os
from distutils.core import Command
from distutils.util import get_platform
from distutils.dir_util import create_tree, remove_tree
from distutils.dir_util import remove_tree
from distutils.errors import *
from distutils.sysconfig import get_python_version
from distutils import log
Expand Down
2 changes: 0 additions & 2 deletions Lib/distutils/cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@
from subprocess import Popen, PIPE, check_output
import re

from distutils.ccompiler import gen_preprocess_options, gen_lib_options
from distutils.unixccompiler import UnixCCompiler
from distutils.file_util import write_file
from distutils.errors import (DistutilsExecError, CCompilerError,
CompileError, UnknownFileError)
from distutils import log
from distutils.version import LooseVersion
from distutils.spawn import find_executable

Expand Down
3 changes: 1 addition & 2 deletions Lib/distutils/msvc9compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

from distutils.errors import DistutilsExecError, DistutilsPlatformError, \
CompileError, LibError, LinkError
from distutils.ccompiler import CCompiler, gen_preprocess_options, \
gen_lib_options
from distutils.ccompiler import CCompiler, gen_lib_options
from distutils import log
from distutils.util import get_platform

Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
DistutilsExecError, DistutilsPlatformError, \
CompileError, LibError, LinkError
from distutils.ccompiler import \
CCompiler, gen_preprocess_options, gen_lib_options
CCompiler, gen_lib_options
from distutils import log

_can_read_reg = False
Expand Down
1 change: 0 additions & 1 deletion Lib/lib2to3/pgen2/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
__all__ = ["Driver", "load_grammar"]

# Python imports
import codecs
import io
import os
import logging
Expand Down
5 changes: 1 addition & 4 deletions Mac/Tools/plistlib_generate_testdata.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#!/usr/bin/env python3

from Cocoa import NSMutableDictionary, NSMutableArray, NSString, NSDate, NSNumber
from Cocoa import NSPropertyListSerialization, NSPropertyListOpenStepFormat
from Cocoa import NSPropertyListSerialization
from Cocoa import NSPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0
from Cocoa import CFUUIDCreateFromString, NSNull, NSUUID, CFPropertyListCreateData
from Cocoa import NSURL

import datetime
from collections import OrderedDict
import binascii

FORMATS=[
# ('openstep', NSPropertyListOpenStepFormat),
('plistlib.FMT_XML', NSPropertyListXMLFormat_v1_0),
('plistlib.FMT_BINARY', NSPropertyListBinaryFormat_v1_0),
]
Expand Down