Skip to content

Commit afa3153

Browse files
committed
Remove pointless "vile hack" that can cause the build step to fail when some extension modules can't be imported.
See issue #5309 for the build failures, issue #458343 for the original motivation.
1 parent 6b8e0ed commit afa3153

2 files changed

Lines changed: 2 additions & 20 deletions

File tree

‎Lib/distutils/command/build_ext.py‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -545,15 +545,8 @@ def build_extension(self, ext):
545545
extra_postargs=extra_args,
546546
depends=ext.depends)
547547

548-
# XXX -- this is a Vile HACK!
549-
#
550-
# The setup.py script for Python on Unix needs to be able to
551-
# get this list so it can perform all the clean up needed to
552-
# avoid keeping object files around when cleaning out a failed
553-
# build of an extension module. Since Distutils does not
554-
# track dependencies, we have to get rid of intermediates to
555-
# ensure all the intermediates will be properly re-built.
556-
#
548+
# XXX outdated variable, kept here in case third-part code
549+
# needs it.
557550
self._built_objects = objects[:]
558551

559552
# Now link the object files together into a "shared object" --

‎setup.py‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,17 +381,6 @@ def check_extension_import(self, ext):
381381
os.remove(newname)
382382
os.rename(ext_filename, newname)
383383

384-
# XXX -- This relies on a Vile HACK in
385-
# distutils.command.build_ext.build_extension(). The
386-
# _built_objects attribute is stored there strictly for
387-
# use here.
388-
# If there is a failure, _built_objects may not be there,
389-
# so catch the AttributeError and move on.
390-
try:
391-
for filename in self._built_objects:
392-
os.remove(filename)
393-
except AttributeError:
394-
self.announce('unable to remove files (ignored)')
395384
except:
396385
exc_type, why, tb = sys.exc_info()
397386
self.announce('*** WARNING: importing extension "%s" '

0 commit comments

Comments
 (0)