Skip to content

fix: emit the yotta (Y) unit in bytes2human - #459

Closed
nikolauspschuetz wants to merge 1 commit into
mahmoud:masterfrom
nikolauspschuetz:fix-bytes2human-yotta
Closed

nikolauspschuetz wants to merge 1 commit into
mahmoud:masterfrom
nikolauspschuetz:fix-bytes2human-yotta

Conversation

@nikolauspschuetz

Copy link
Copy Markdown
Contributor

bytes2human never emitted the largest unit Y (yotta): _SIZE_RANGES zips the size bounds with their successors, so the loop's symbol only ranges over B…Z, and yotta-scale values overflow into Z — bytes2human(1024**8) returned '1024Z' instead of '1Y'.

Pairs the last bound with an (inf, '') sentinel so the Y range is reachable, and adds a doctest.

Verified: bytes2human(1024**8) == '1Y' (and 5Y), Z still correct, all strutils doctests pass.

Developed with AI assistance (Claude Code); I directed, reviewed, and verified it locally.

_SIZE_RANGES zipped the size bounds with their successors, so the loop
symbol only ranged over B..Z and the largest unit "Y" was never emitted;
yotta-scale values overflowed into Z (e.g. bytes2human(1024**8) returned
'1024Z' instead of '1Y'). Pair the last bound with an infinite sentinel
so the Y range is reached, and add a doctest.
mahmoud added a commit that referenced this pull request Sep 7, 2026
Fold #463, #466, #476, #478, #460, #459, and #477 with focused regressions and 26.2.0 release notes.

Verified 672 local tests and the full GitHub Actions matrix before merge.

Co-authored-by: Ali Zulfiqar <codewithfourtix@gmail.com>
Co-authored-by: Guo Jiarui <799423879@qq.com>
Co-authored-by: Nikolaus Schuetz <nikolauspschuetz@gmail.com>
Co-authored-by: Raiyan Zaman <77029110+rzaman8677@users.noreply.github.com>
@mahmoud

mahmoud commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Folded into #481 with credit (Co-authored-by). Thanks!

@mahmoud mahmoud closed this Sep 7, 2026
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