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 <rep...@bugs.python.org>
<http://bugs.python.org/issue20705>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to