Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in the CLI tests newline processing, then simplify it further #3559

Merged
merged 2 commits into from
Mar 20, 2023

Conversation

ppentchev
Copy link
Contributor

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

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 ~]$
@facebook-github-bot
Copy link

Hi @ppentchev!

Thank you for your pull request and welcome to our community.

Action Required

In 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.

Process

In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@ppentchev
Copy link
Contributor Author

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.

@yoniko
Copy link
Contributor

yoniko commented Mar 20, 2023

Thank you for contributing, the changes look good to me.

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.

Yes, it's unrelated and is most likely due to the bug fixed in #3556.

@terrelln terrelln merged commit 3b001a3 into facebook:dev Mar 20, 2023
@ppentchev ppentchev deleted the pp-tests-newline branch March 20, 2023 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants