From: Fredrik Tolf Date: Sat, 19 Jan 2013 00:35:43 +0000 (+0100) Subject: Merge branch 'master' into python3 X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=9b6845a6a793a189bad2788333663ef4407012e1;p=pdm.git Merge branch 'master' into python3 Conflicts: pdm/srv.py --- 9b6845a6a793a189bad2788333663ef4407012e1 diff --cc pdm/srv.py index abf7d89,b2c131a..80f9a26 --- a/pdm/srv.py +++ b/pdm/srv.py @@@ -56,18 -55,20 +56,20 @@@ class repl(object) ccode = compile(cmd, "PDM Input", "eval") except SyntaxError: ccode = compile(cmd, "PDM Input", "exec") - exec ccode in self.mod.__dict__ - self.cl.send("+OK\n") + exec(ccode, self.mod.__dict__) + self.cl.send(b"+OK\n") else: self.echo(eval(ccode, self.mod.__dict__)) - self.cl.send("+OK\n") + self.cl.send(b"+OK\n") except: - for line in traceback.format_exception(*sys.exc_info()): - self.cl.send(b" " + line.encode("utf-8")) + lines = ("".join(traceback.format_exception(*sys.exc_info()))).split("\n") + while len(lines) > 0 and lines[-1] == "": lines = lines[:-1] + for line in lines: - self.cl.send(" " + line + "\n") - self.cl.send("+EXC\n") ++ self.cl.send(b" " + line.encode("utf-8") + b"\n") + self.cl.send(b"+EXC\n") def handle(self, buf): - p = buf.find("\n\n") + p = buf.find(b"\n\n") if p < 0: return buf cmd = buf[:p + 1]