gh-81313: Add the math.integer module (PEP-791)#133909
gh-81313: Add the math.integer module (PEP-791)#133909serhiy-storchaka merged 30 commits intopython:mainfrom
Conversation
|
This is a further development of #13741. |
|
A PEP is being written for this module: skirpichev/peps#8 |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
I used other way to fix the module name. This is a temporary hack, I hope we will make it a straight way in future. |
|
I think test failures are relevant. |
Misc/NEWS.d/next/Library/2019-06-02-13-56-16.gh-issue-81313.axawSH.rst
Outdated
Show resolved
Hide resolved
IMO it's good enough for a first iteration, we will have enough time until Python 3.15 final to find a way to fix these issues. |
…awSH.rst Co-authored-by: Victor Stinner <vstinner@python.org>
skirpichev
left a comment
There was a problem hiding this comment.
Playing with the new module, I found also this:
>>> math.integer.__spec__
ModuleSpec(name='_math_integer', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0x7fdbdae6f150>, origin='/home/sk/src/cpython/build/lib.linux-x86_64-3.15/_math_integer.cpython-315-x86_64-linux-gnu.so')| For backward compatibility, the :mod:`math` module provides also aliases of | ||
| the following functions from the :mod:`math.integer` module: |
There was a problem hiding this comment.
Please mention there, that these aliases are soft-deprecated.
BTW, why this section was moved?
There was a problem hiding this comment.
Because it is less important than other sections.
There was a problem hiding this comment.
Maybe it is, if we want to communicate users this renaming. Though, it's important only for those who read docs in order... Up to you.
| /* Fix the __name__ attribute of the module and the __module__ attribute | ||
| * of its functions. | ||
| */ |
There was a problem hiding this comment.
Could you, please, create an issue to track this?
IIUIC, currently it's also not clear how to name the module file (math_integermodule.c, math/integermodule.c or even intmathmodule.c). I.e. we should extend current naming scheme to submodules.
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
skirpichev
left a comment
There was a problem hiding this comment.
LGTM, with few nitpicks (up to Serhiy) and note about ModuleSpec(). (I suspect this might affect something.)
| .. versionchanged:: 3.10 | ||
| Floats with integral values (like ``5.0``) are no longer accepted in the | ||
| :func:`factorial` function. | ||
|
|
There was a problem hiding this comment.
Maybe add a versionchanged to mention that these functions became aliases to math.integer functions?
There was a problem hiding this comment.
This did not change their behavior.
| Floats with integral values (like ``5.0``) are no longer accepted in the | ||
| :func:`factorial` function. | ||
|
|
||
|
|
There was a problem hiding this comment.
You should add .. deprecated:: 3.15 to repeat that these functions are soft deprecated and math.integer functions should be used instead.
📚 Documentation preview 📚: https://cpython-previews--133909.org.readthedocs.build/