Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 088025f

Browse files
committed
Use list constructor or built-in method instead of copy module
1 parent ba661a9 commit 088025f

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

Lib/packaging/compiler/cygwinccompiler.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848

4949
import os
5050
import sys
51-
import copy
5251

5352
from packaging import logger
5453
from packaging.compiler.unixccompiler import UnixCCompiler
@@ -172,9 +171,9 @@ def link(self, target_desc, objects, output_filename, output_dir=None,
172171
extra_postargs=None, build_temp=None, target_lang=None):
173172
"""Link the objects."""
174173
# use separate copies, so we can modify the lists
175-
extra_preargs = copy.copy(extra_preargs or [])
176-
libraries = copy.copy(libraries or [])
177-
objects = copy.copy(objects or [])
174+
extra_preargs = list(extra_preargs or [])
175+
libraries = list(libraries or [])
176+
objects = list(objects or [])
178177

179178
# Additional libraries
180179
libraries.extend(self.dll_libraries)

Lib/packaging/run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import sys
66
import getopt
77
import logging
8-
from copy import copy
98

109
from packaging import logger
1110
from packaging.dist import Distribution
@@ -673,7 +672,7 @@ def __call__(self):
673672

674673
def main(args=None):
675674
old_level = logger.level
676-
old_handlers = copy(logger.handlers)
675+
old_handlers = list(logger.handlers)
677676
try:
678677
dispatcher = Dispatcher(args)
679678
if dispatcher.action is None:

Lib/packaging/util.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import posixpath
1515
import sysconfig
1616
import subprocess
17-
from copy import copy
1817
from glob import iglob as std_iglob
1918
from fnmatch import fnmatchcase
2019
from inspect import getsource
@@ -384,7 +383,7 @@ def byte_compile(py_files, optimize=0, force=False, prefix=None,
384383
elif optimize == 2:
385384
cmd.insert(1, "-OO")
386385

387-
env = copy(os.environ)
386+
env = os.environ.copy()
388387
env['PYTHONPATH'] = os.path.pathsep.join(sys.path)
389388
try:
390389
spawn(cmd, env=env)

0 commit comments

Comments
 (0)