summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/bytearray_construct.py
Commit message (Collapse)AuthorAge
* py/objarray: Detect bytearray(str) without an encoding.Jim Mussared2022-11-08
| | | | | | | | | 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>
* py/objarray: bytearray: Allow 2nd/3rd arg to constructor.Paul Sokolovsky2018-09-11
| | | | | | | | | | | | | | | | | | 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.)
* tests/basic: Make various tests skippable.Paul Sokolovsky2017-03-09
|
* tests: Split byteorder-dependent tests to *_endian.py's.Paul Sokolovsky2015-08-30
|
* tests: Separate out test cases that rely on float support to float/ dir.Damien George2015-01-08
|
* py: Allow bytes/bytearray/array to be init'd by buffer protocol objects.Damien George2014-12-04
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).