From b6b9fd9a4e2c6c1f32119531347314c5faae4ced 2017-05-24 21:11:43 From: Matthias Bussonnier Date: 2017-05-24 21:11:43 Subject: [PATCH] Merge pull request #10570 from srinivasreddy/py2_code Remove python2 code --- diff --git a/IPython/core/page.py b/IPython/core/page.py index 4499609..1a966e1 100644 --- a/IPython/core/page.py +++ b/IPython/core/page.py @@ -106,18 +106,6 @@ def _detect_screen_size(screen_lines_def): # can fail on Linux 2.6, pager_page will catch the TypeError raise TypeError('termios error: {0}'.format(err)) - # Curses modifies the stdout buffer size by default, which messes - # up Python's normal stdout buffering. This would manifest itself - # to IPython users as delayed printing on stdout after having used - # the pager. - # - # We can prevent this by manually setting the NCURSES_NO_SETBUF - # environment variable. For more details, see: - # http://bugs.python.org/issue10144 - NCURSES_NO_SETBUF = os.environ.get('NCURSES_NO_SETBUF', None) - os.environ['NCURSES_NO_SETBUF'] = '' - - # Proceed with curses initialization try: scr = curses.initscr() except AttributeError: @@ -127,12 +115,6 @@ def _detect_screen_size(screen_lines_def): screen_lines_real,screen_cols = scr.getmaxyx() curses.endwin() - # Restore environment - if NCURSES_NO_SETBUF is None: - del os.environ['NCURSES_NO_SETBUF'] - else: - os.environ['NCURSES_NO_SETBUF'] = NCURSES_NO_SETBUF - # Restore terminal state in case endwin() didn't. termios.tcsetattr(sys.stdout,termios.TCSANOW,term_flags) # Now we have what we needed: the screen size in rows/columns