-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
gh-140824: Implement the math package in Python #141363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
9f5cc45
f2650f7
a6430dc
f510afd
2d2afd6
d60e832
7cf0fc1
a20e9fb
2527857
aaeaee1
d366724
49e6b3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| """ | ||
| math module -- Mathematical functions | ||
| """ | ||
|
|
||
| from _math import * | ||
|
|
||
| # gh-140824: Fix module name for pickle | ||
| def patch_module(objs, module): | ||
|
Comment on lines
+8
to
+9
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better just to have the module name as
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In C, |
||
| for obj in objs: | ||
| if not hasattr(obj, "__module__"): | ||
| continue | ||
| obj.__module__ = module | ||
| patch_module([obj for name, obj in globals().items() | ||
| if not name.startswith('_')], 'math') | ||
|
|
||
| from _math_integer import comb, factorial, gcd, isqrt, lcm, perm | ||
| patch_module([comb, factorial, gcd, isqrt, lcm, perm], 'math.integer') | ||
|
|
||
| del patch_module | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| """ | ||
| math.integer module -- integer-specific mathematics functions | ||
| """ | ||
|
|
||
| from _math_integer import * |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.