summaryrefslogtreecommitdiff
path: root/tests/basics/bytearray_construct.py
AgeCommit message (Collapse)Author
2022-11-08py/objarray: Detect bytearray(str) without an encoding.Jim Mussared
This prevents a very subtle bug caused by writing e.g. `bytearray('\xfd')` which gives you `(0xc3, 0xbd)`. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2018-09-11py/objarray: bytearray: Allow 2nd/3rd arg to constructor.Paul Sokolovsky
If bytearray is constructed from str, a second argument of encoding is required (in CPython), and third arg of Unicode error handling is allowed, e.g.: bytearray("str", "utf-8", "strict") This is similar to bytes: bytes("str", "utf-8", "strict") This patch just allows to pass 2nd/3rd arguments to bytearray, but doesn't try to validate them to not impact code size. (This is also similar to how bytes constructor is handled, though it does a bit more validation, e.g. check that in case of str arg, encoding argument is passed.)
2017-03-09tests/basic: Make various tests skippable.Paul Sokolovsky
2015-08-30tests: Split byteorder-dependent tests to *_endian.py's.Paul Sokolovsky
2015-01-08tests: Separate out test cases that rely on float support to float/ dir.Damien George
2014-12-04py: Allow bytes/bytearray/array to be init'd by buffer protocol objects.Damien George
Behaviour of array initialisation is subtly different for bytes, bytearray and array.array when argument has buffer protocol. This patch gets us CPython conformant (except we allow initialisation of array.array by buffer with length not a multiple of typecode).