FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-128863: deprecate _PyLong_FromDigits() function by skirpichev · Pull Request #127939 · python/cpython · GitHub

/ cpython Public

gh-128863: deprecate _PyLong_FromDigits() function - #127939

Merged
vstinner merged 6 commits into
python:mainfrom
skirpichev:deprecate-_PyLong_FromDigits/127937
Jan 24, 2025
Merged

gh-128863: deprecate _PyLong_FromDigits() function#127939
vstinner merged 6 commits into
python:mainfrom
skirpichev:deprecate-_PyLong_FromDigits/127937

Conversation

skirpichev commented Dec 14, 2024
edited
Loading

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member Author

Ok, this depend on #127925

skirpichev marked this pull request as draft December 14, 2024 07:30
skirpichev requested a review from vstinner January 23, 2025 03:09
skirpichev changed the title gh-127937: deprecate _PyLong_FromDigits() function gh-128863: deprecate _PyLong_FromDigits() function Jan 23, 2025

Copy link
Copy Markdown
Member

Ok, this depend on #127925

You can use the macros in _decimal:

    _Py_COMP_DIAG_PUSH
    _Py_COMP_DIAG_IGNORE_DEPR_DECLS
...
    _Py_COMP_DIAG_POP

See examples in Modules/_testcapimodule.c.

Copy link
Copy Markdown
Member

_PyLong_Copy() emits a deprecation warning. You can rename _PyLong_FromDigits() to long_fromdigits() and use this one in _PyLong_Copy().

Copy link
Copy Markdown
Member Author

_PyLong_Copy() emits a deprecation warning.

This is a draft due to #127925.

You can rename _PyLong_FromDigits() to long_fromdigits() and use this one in _PyLong_Copy().

That does make sense if no stdlib module will depend on _PyLong_FromDigits(). Unfortunately, there is no short cut for copy.copy() in C-API.

Copy link
Copy Markdown
Member

This is a draft due to #127925.

I'm not sure that PR gh-127925 is ever going to be merged :-(

That does make sense if no stdlib module will depend on _PyLong_FromDigits(). Unfortunately, there is no short cut for copy.copy() in C-API.

I didn't understand your comment. I'm only proposing a local "fix" for _PyLong_Copy() to avoid the deprecation warning.

Copy link
Copy Markdown
Member Author

I didn't understand your comment.

Nevermind, I was thinking about _PyLong_Copy(), which is also public now.

I'm only proposing a local "fix" for _PyLong_Copy() to avoid the deprecation warning.

That seems fine. But maybe we should just inline code, it's not used anywhere else in the longobject.c.

skirpichev marked this pull request as ready for review January 24, 2025 06:21

Copy link
Copy Markdown
Member Author

Ok, I did this ready for review. Once #127925 will be merged - this should pass tests.

After some thinking, the _PyLong_FromDigits() code was inlined in the _PyLong_Copy(). I doubt we need for _PyLong_FromDigits() in future.

Copy link
Copy Markdown
Member

You should use _Py_COMP_DIAG_IGNORE_DEPR_DECLS in _decimal.c, as I wrote in my previous comment.

Copy link
Copy Markdown
Member Author

You should use _Py_COMP_DIAG_IGNORE_DEPR_DECLS in _decimal.c, as I wrote in my previous comment.

No, this rather fits for testing code.

Comment thread Objects/longobject.c Outdated
skirpichev requested a review from vstinner January 24, 2025 11:45
vstinner merged commit 233fd00 into python:main Jan 24, 2025

Copy link
Copy Markdown
Member

Merged, thanks.

skirpichev deleted the deprecate-_PyLong_FromDigits/127937 branch January 24, 2025 12:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL