-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Increase range of bytes_per_sep #147944
Copy link
Copy link
Closed
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Metadata
Metadata
Assignees
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Feature or enhancement
The
hex()method ofbytes,bytearrayandmemoryview, and thebinascii.b2a_hex()function acceptbytes_per_separgument in the range of C int. This is unusual, because maximal size for in-memory structures in Python is limited bysys.maxsize. Actually, passingbytes_per_seplarger thansys.maxsizeor less than-sys.maxsizedoes not make sense, because it will be larger than the length of the converted byte sequence. But this is not so for C int. You get an OverflowError trying to insert a separator every 10GiB in 100GiB data. Yes, the example is not realistic, but this is a matter of principal possibility.Linked PRs