Skip to content

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