pypy / pypy / rlib /

The branch 'stm-gc' does not exist.
# This are here only because it's always better safe than sorry.
# The issue is that from-time-to-time CPython's termios.tcgetattr
# returns list of mostly-strings of length one, but with few ints
# inside, so we make sure it works

import termios
from termios import *

def tcgetattr(fd):
        lst = list(termios.tcgetattr(fd))
    except termios.error, e:
        raise OSError(*e.args)
    cc = lst[-1]
    next_cc = []
    for c in cc:
        if isinstance(c, int):
    lst[-1] = next_cc
    return tuple(lst)

def tcsetattr(fd, when, mode):
    # there are some bizarre requirements for that, stealing directly
    # from cpython
    mode_l = list(mode)
    if mode_l[3] & termios.ICANON:
        cc = mode_l[-1]
        cc[termios.VMIN] = ord(cc[termios.VMIN])
        cc[termios.VTIME] = ord(cc[termios.VTIME])
        mode_l[-1] = cc
        return termios.tcsetattr(fd, when, mode_l)
    except termios.error, e:
        raise OSError(*e.args)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.