Message310914
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 |
|
Date |
User |
Action |
Args |
2018-01-28 04:33:30 | ncoghlan | set | recipients:
+ ncoghlan, steven.daprano, asvetlov |
2018-01-28 04:33:30 | ncoghlan | set | messageid: <1517114010.41.0.467229070634.issue32321@psf.upfronthosting.co.za> |
2018-01-28 04:33:30 | ncoghlan | link | issue32321 messages |
2018-01-28 04:33:30 | ncoghlan | create | |
|