Repository navigation
check for detached stream buffer in utils.misc.isatty() - #1948
Conversation
|
Admin, can CI be enabled? |
|
|
Refer to this link for build results (access rights to CI server needed): |
|
I've added a utest in utils/test_misc |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
There was a problem hiding this comment.
Nitpicking: No need to have an empty row between standard library imports.
|
Looks very good to me. Few more comments, though:
|
|
@userzimmermann, have you had a change to look at this lately? I'm going through PRs today and would like to merge as many as I can. This one looks pretty good already. |
|
Refer to this link for build results (access rights to CI server needed): |
|
|
Refer to this link for build results (access rights to CI server needed): |
|
This PR looks good to be merged. Could you still squash commits and submit an issue about this? |
|
As you like it ;) #2003 |
|
Refer to this link for build results (access rights to CI server needed): |
check for detached stream buffer in utils.misc.isatty()
|
Thanks @userzimmermann! |
If the
.bufferof aniomodule based stream was detached, thestream.isatty()method called inutils.misc.isatty()will raise aValueError. Asutils.misc.isatty()is usually only applied tosys.stdoutandsys.stderrit most likely won't happen in Python 2. But who knows what other streams this function might be used with or what other projects might do withsys.std...before importingrobot. And the buffer check is definitely needed for Python 3 compatibility. I encountered it recently on adding Sphinx based docs to my robotframework-tools project and runningsetup.py build_sphinxwith Python 3, using a conf.py which importsrobot. And just imprtingrobotis enough, because the creation ofrobot.output.logger.LOGGERleads to the use ofisatty(). Maybe my fix is not at the best place and streams should be checked earlier...