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.

Author ncoghlan
Recipients asvetlov, ncoghlan, steven.daprano
Date 2018-01-28.04:33:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1517114010.41.0.467229070634.issue32321@psf.upfronthosting.co.za>
In-reply-to
Content
Reviewing the code and the CI test failures on the PR, the trick here is that functools isn't actually *using* functools.reduce, it's just re-exporting it if it's defined.

So if you block importing of "_functools" (which the test suite does in order to test the pure Python fallbacks), then the *only* consequence is that "functools.reduce" will be missing - the module will otherwise be fine.

This isn't at all clear when reading the code though, so I think the simplest resolution here would be to add a comment to the fallback path that says "If _functools.reduce is missing, then functools.reduce will also be missing, but the module will otherwise work".

Alternatively, we could add a fallback implementation based on the recipe in the docs, and adjust the test suite to actually run the reduce tests against the py_functools variant: https://docs.python.org/3/library/functools.html#functools.reduce
History
Date User Action Args
2018-01-28 04:33:30ncoghlansetrecipients: + ncoghlan, steven.daprano, asvetlov
2018-01-28 04:33:30ncoghlansetmessageid: <1517114010.41.0.467229070634.issue32321@psf.upfronthosting.co.za>
2018-01-28 04:33:30ncoghlanlinkissue32321 messages
2018-01-28 04:33:30ncoghlancreate