Skip to content

Fix fd encodings #629

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

Merged
merged 4 commits into from
Oct 11, 2020
Merged

Fix fd encodings #629

merged 4 commits into from
Oct 11, 2020

Conversation

thomasballinger
Copy link
Member

I propose we provide fileno() methods and .encoding properties on fake file objects that replace sys.stdin/stdout/stderr. Applications may use them in ways that work or in ways that don't, but we should just provide them and see what happens.

Pro: users can use more libraries with bpython

Con: code may break in less expected ways that the straightforward attribute errors they break on now, e.g. the display may break when a program writes directly to sys.stdout.fileno() because that won't be caught by bpython

@thomasballinger
Copy link
Member Author

Given more activity on #622 I'll plan to look at merging this tomorrow.

this is both more accurate and corrects the spelling from UTF8 to UTF-8
Start storing an original file object on the fake one.
out = FakeOutput(mock.Mock(), self.assert_unicode)
out.write("native string type")
out = FakeOutput(mock.Mock(), self.assert_unicode, None)
out.write('native string type')
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change it back to "" (or run black before merging the changes).

@thomasballinger thomasballinger merged commit e59905b into master Oct 11, 2020
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