Skip to content

Open binary no encoding - #665

Merged
mrbean-bremen merged 1 commit into
pytest-dev:masterfrom
yaythomas:binary-no-encoding
Feb 3, 2022
Merged

mrbean-bremen merged 1 commit into
pytest-dev:masterfrom
yaythomas:binary-no-encoding

Conversation

@yaythomas

Copy link
Copy Markdown
Contributor

On open() binary mode should not allow an encoding argument. See #664.

If encoding is passed with binary mode, raise: ValueError(binary mode doesn't take an encoding argument)

Add unit test helper to check the open() constructor call. Test for both binary and text mode with encoding, where binary fails and text passes.

@yaythomas

Copy link
Copy Markdown
Contributor Author

When I did my local due diligence to pre-check that the CI checks will all pass, I got a mypy error:

pyfakefs/fake_filesystem_unittest.py:750: error: Module has no attribute "_HAS_FCOPYFILE"  [attr-defined]
Found 1 error in 1 file (checked 23 source files)

I'm pretty sure this is not related to the changeset under consideration.

It might have something to do with issue #542.

@mrbean-bremen mrbean-bremen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good! Can you add an entry to the release notes (CHANGES.md)?

                                                                                                                            On open() binary mode should not allow an encoding argument.
                                                                                                                            If encoding is passed with binary mode, raise:
                                                                                                                            ValueError(binary mode doesn\'t take an encoding argument)

                                                                                                                            Closes pytest-dev#664.
@mrbean-bremen
mrbean-bremen merged commit 80daca8 into pytest-dev:master Feb 3, 2022
@yaythomas
yaythomas deleted the binary-no-encoding branch February 3, 2022 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants