Fix a bug in the CLI tests newline processing, then simplify it further#3559
Fix a bug in the CLI tests newline processing, then simplify it further#3559terrelln merged 2 commits intofacebook:devfrom
Conversation
In Python 3.x, a single element of a bytes array is returned as
an integer number. Thus, NEWLINE is an int variable, and attempting
to add it to the line array will fail with a type mismatch error
that may be demonstrated as follows:
[roam@straylight ~]$ python3 -c 'b"hello" + b"\n"[0]'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: can't concat int to bytes
[roam@straylight ~]$
|
Hi @ppentchev! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
The assertion failure in https://github.com/facebook/zstd/actions/runs/4457266947/jobs/7835977518#step:5:1222 does not seem related to the changes in the Python wrapper analyzing the programs' output. |
|
Thank you for contributing, the changes look good to me.
Yes, it's unrelated and is most likely due to the bug fixed in #3556. |
Hi,
First of all, thanks a lot for writing and maintaining zstd!
What do you think about the attached trivial changes? The first one fixes a type mismatch bug: an element of a bytes array is an int value, so it cannot be appended to a bytes array. The second one uses
.split(..., maxsplit=1)to simplify the line splitting code.Thanks again, and keep up the great work!
G'luck,
Peter