[New-bugs-announce] [issue20705] distutils.extension.Extension with empty 'sources' list

Rémi Rampin report at bugs.python.org
Thu Feb 20 20:08:14 CET 2014

New submission from Rémi Rampin:

While this is obviously a programming error, distutils currently has no check for the 'sources' list being empty, which might or might not result in a self-explanatory error message once the CCompiler's link() method is called (the exact error depends on the subclass's implementation).

It seems that some code had been put in initially to handle this case ('objects or []' constructs) but this has been broken since (objects[0] used by most subclasses).

Since objects can only be empty if sources was empty, I think catching this case in build_extension() (only caller of link_shared_object) makes sense.

Trivial patch attached, should apply on all versions.

components: Distutils
files: distutils-catch-empty-sources.diff
keywords: patch
messages: 211743
nosy: remram
priority: normal
severity: normal
status: open
title: distutils.extension.Extension with empty 'sources' list
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file34154/distutils-catch-empty-sources.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list