This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: distutils.extension.Extension with empty 'sources' list
Type: behavior Stage: resolved
Components: Distutils Versions: Python 2.7
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: remram, steve.dower
Priority: normal Keywords: patch

Created on 2014-02-20 19:08 by remram, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
distutils-catch-empty-sources.diff remram, 2014-02-20 19:08 Patch for command/
Messages (2)
msg211743 - (view) Author: Rémi Rampin (remram) * Date: 2014-02-20 19:08
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.
msg386425 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:30
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at
Date User Action Args
2022-04-11 14:57:58adminsetgithub: 64904
2021-02-03 18:30:35steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386425

resolution: out of date
stage: resolved
2014-02-20 19:08:14remramcreate