gh-140824: Implement the math package in Python#141363
gh-140824: Implement the math package in Python#141363vstinner wants to merge 12 commits intopython:mainfrom
Conversation
Rename the 'math' extension to '_math'.
| # gh-140824: Fix module name for pickle | ||
| def patch_module(objs, module): |
There was a problem hiding this comment.
Would it be better just to have the module name as math.integer for these functions in C?
There was a problem hiding this comment.
In C, function.__module__ is set to the extension name: so set to _math or _math_integer. The whole purpose of this PR is to fix function.__module__.
|
When you're done making the requested changes, leave the comment: |
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
|
@AA-Turner: I addressed your review. Please review the updated PR. |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
This is still a hack. I think there should be more straightforward way.
| from _math_integer import comb, factorial, gcd, isqrt, lcm, perm | ||
| patch_module([comb, factorial, gcd, isqrt, lcm, perm], 'math.integer') |
There was a problem hiding this comment.
Maybe then instead:
import _math_integer
patch_module(_math_integer, 'math.integer')where in the patch_module() you will fix all public names in the submodule namespace?
This still be a hack, but at least we can factor out patch_module() to some helper function, that can be used when a new submodule will be added to the stdlib.
|
I believe there is a way to do this without hacks. |
|
@serhiy-storchaka dislikes this approach, so I prefer to close my PR. |
Rename the 'math' extension to '_math'.