def multiline(self, firstline=''):
        full_input = []
        # keep a list of the entries that we've made in history
        old_hist = []
        if firstline:
            print '  ' + firstline
            full_input.append(firstline)
        while True:
            if self._readline:
                # add the current readline position
                old_hist.append(self._readline.get_current_history_length())
            if self.use_rawinput:
                try:
                    line = raw_input(self.multiline_prompt)
                except EOFError:
                    line = 'EOF'
            else:
                self.stdout.write(self.multiline_prompt)
                self.stdout.flush()
                line = self.stdin.readline()
                if not len(line):
                    line = 'EOF'
                else:
                    line = line[:-1] # chop \n
            if line == 'EOF':
                break
            full_input.append(line)

        # add the final readline history position
        if self._readline:
            old_hist.append(self._readline.get_current_history_length())

        cmd = '\n'.join(full_input) + '\n'

        if self._readline:
            # remove the old, individual readline history entries.

            # first remove any duplicate entries
            old_hist = sorted(set(old_hist))

            # Make sure you do this in reversed order so you move from
            # the end of the history up.
            for pos in reversed(old_hist):
                # get_current_history_length returns pos + 1
                self._readline.remove_history_item(1 - pos)
            # now add the full line
            self._readline.add_history(cmd)

        locals = self.curframe.f_locals
        globals = self.curframe.f_globals
        print
        self.save_history()
        try:
            try:
                code = compile(cmd, '<stdin>', 'single')
                exec code in globals, locals
            except:
                print self._reprExc()
        finally:
            self.read_history()
dataset/ETHPy150Open sassoftware/conary/conary/lib/epdb_embedded/__init__.py/Epdb.multiline/swapped operands of `-`