diff options
| author | Thomas Kluyver <takowl@gmail.com> | 2013-09-19 16:45:06 -0700 |
|---|---|---|
| committer | Thomas Kluyver <takowl@gmail.com> | 2013-09-19 16:45:06 -0700 |
| commit | 88ea4efdb917bd8e02566e0cddf952f714733bcc (patch) | |
| tree | 05c4bf4574595d28e247c8d5b637521085946aa3 /doc | |
| parent | 86efcc0ceb229e8cf09c0b61b977429d5f301d09 (diff) | |
| download | pexpect-88ea4efdb917bd8e02566e0cddf952f714733bcc.tar.gz | |
Add spawnu interface for unicode
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/api/pexpect.rst | 25 | ||||
| -rw-r--r-- | doc/conf.py | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/doc/api/pexpect.rst b/doc/api/pexpect.rst index 7c5ca47..bc24003 100644 --- a/doc/api/pexpect.rst +++ b/doc/api/pexpect.rst @@ -34,6 +34,12 @@ spawn object communication, data read from the child process, or data sent to the child process. + .. note:: + + With a :class:`spawn` instance, the log files should be open for + writing binary data. With a :class:`spawnu` instance, they should + be open for writing unicode text. + Controlling the child process ````````````````````````````` @@ -58,6 +64,25 @@ Controlling the child process The file descriptor used to communicate with the child process. +Handling unicode +```````````````` + +For backwards compatibility, :class:`spawn` can handle some Unicode: its +send methods will encode arbitrary unicode as UTF-8 before sending it to the +child process, and its expect methods can accept ascii-only unicode strings. +However, for a proper unicode API to a subprocess, use this subclass: + +.. autoclass:: spawnu + :show-inheritance: + +.. note:: + + Unicode handling with pexpect works the same way on Python 2 and 3, despite + the difference in names. I.e.: + + - :class:`spawn` works with ``str`` on Python 2, and :class:`bytes` on Python 3, + - :class:`spawnu` works with ``unicode`` on Python 2, and :class:`str` on Python 3. + run function ------------ diff --git a/doc/conf.py b/doc/conf.py index 84c5ab2..4c82213 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -243,4 +243,4 @@ texinfo_documents = [ # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'http://docs.python.org/': None} +intersphinx_mapping = {'http://docs.python.org/3/': None} |
