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

Add **kwargs to PtyProcess.spawn #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dong-zeyu
Copy link

The PtyProcessUnicode class accept keywords argument like encoding and codec_errors. However, it seems not easy to set these argument just using PtyProcess.spawn.

I think we could add a **kwargs to spawn and create the class instance using cls(pid, fd, **kwargs). It will be neat and improve extensibility.

@takluyver
Copy link
Member

This seems reasonable to me. Sorry to have left it so long without looking at it. If you're still interested, could you add a test of using the arguments for unicode decoding?

@dong-zeyu
Copy link
Author

Thanks for your reply. A test was added. It will try to print some non-utf8 char and check whether the error handling argument is taking effect.

@takluyver
Copy link
Member

Hmm, it seems like there's something funny going on with the tests on MacOS 😕

The **kwargs will be passed to create the class instance.
@dong-zeyu
Copy link
Author

I see. Looks like printf in MacOS does not support \xXX format to hex value. I will use octal number instead. This should be unix compatible.

Copy link
Member

@takluyver takluyver left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good to me.

There's a discussion underway in #76 about whether ptyprocess should still test on Python 2.7, so I'll hold off on merging this for now.

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