| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| """ | ||
| This module provides access to the mathematical functions | ||
| defined by the C standard. | ||
| """ | ||
|
|
||
| from _math import * | ||
|
|
||
| # gh-140824: Fix module name for pickle | ||
| def patch_module(objs, module): | ||
|
Comment thread
Comment on lines
+8
to
+9
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWould it be better just to have the module name as math.integer for these functions in C?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIn 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__.
Sorry, something went wrong.
All reactions
|
||
| 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') | ||
|
Comment thread
Comment on lines
+17
to
+18
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityMaybe 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.
Sorry, something went wrong.
All reactions
|
||
|
|
||
| del patch_module | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| """ | ||
| This module provides access to integer related mathematical functions. | ||
| """ | ||
|
|
||
| from _math_integer import * |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.