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

[3.14] gh-71810: Fix corner case (length==0) for int.to_bytes() (GH-138739) by miss-islington · Pull Request #138782 · python/cpython · GitHub

Repository navigation

[3.14] gh-71810: Fix corner case (length==0) for int.to_bytes() (GH-138739) - #138782

Merged
hugovk merged 1 commit into
python:3.14from
miss-islington:backport-011179a-3.14
Sep 12, 2025
Merged

hugovk merged 1 commit into
python:3.14from
miss-islington:backport-011179a-3.14

Conversation

miss-islington commented Sep 11, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor
>>> (0).to_bytes(0, 'big', signed=True)
b''
>>> (-1).to_bytes(0, 'big', signed=True)  # was b''
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    (-1).to_bytes(0, 'big', signed=True)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
OverflowError: int too big to convert

(cherry picked from commit 011179a)

Co-authored-by: Sergey B Kirpichev skirpichev@gmail.com
Co-authored-by: Serhiy Storchaka storchaka@gmail.com

…nGH-138739)

```pycon
>>> (0).to_bytes(0, 'big', signed=True)
b''
>>> (-1).to_bytes(0, 'big', signed=True)  # was b''
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    (-1).to_bytes(0, 'big', signed=True)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
OverflowError: int too big to convert
```
(cherry picked from commit 011179a)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

hugovk merged commit 440b83f into python:3.14 Sep 12, 2025
52 checks passed
miss-islington deleted the backport-011179a-3.14 branch January 2, 2026 17:55
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.

4 participants


Back | FazBrowse Home | New Git URL