From 410e840c85727e56c6f8872b23e2976510fa7618 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Tue, 15 Feb 2000 21:59:50 +0000 Subject: add a little debugging support when new.code raises SystemError --- Lib/compiler/pyassem.py | 26 +++++++++++++++++++++----- Tools/compiler/compiler/pyassem.py | 26 +++++++++++++++++++++----- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Lib/compiler/pyassem.py b/Lib/compiler/pyassem.py index 047836b..2200dec 100644 --- a/Lib/compiler/pyassem.py +++ b/Lib/compiler/pyassem.py @@ -140,11 +140,27 @@ class PyAssembler: if self.flags & CO_VARKEYWORDS: self.argcount = self.argcount - 1 stacksize = findDepth(self.insts) - co = new.code(self.argcount, nlocals, stacksize, - self.flags, lnotab.getCode(), self._getConsts(), - tuple(self.names), tuple(self.varnames), - self.filename, self.name, self.firstlineno, - lnotab.getTable()) + try: + co = new.code(self.argcount, nlocals, stacksize, + self.flags, lnotab.getCode(), self._getConsts(), + tuple(self.names), tuple(self.varnames), + self.filename, self.name, self.firstlineno, + lnotab.getTable()) + except SystemError, err: + print err + print repr(self.argcount) + print repr(nlocals) + print repr(stacksize) + print repr(self.flags) + print repr(lnotab.getCode()) + print repr(self._getConsts()) + print repr(self.names) + print repr(self.varnames) + print repr(self.filename) + print repr(self.name) + print repr(self.firstlineno) + print repr(lnotab.getTable()) + raise return co def _getConsts(self): diff --git a/Tools/compiler/compiler/pyassem.py b/Tools/compiler/compiler/pyassem.py index 047836b..2200dec 100644 --- a/Tools/compiler/compiler/pyassem.py +++ b/Tools/compiler/compiler/pyassem.py @@ -140,11 +140,27 @@ class PyAssembler: if self.flags & CO_VARKEYWORDS: self.argcount = self.argcount - 1 stacksize = findDepth(self.insts) - co = new.code(self.argcount, nlocals, stacksize, - self.flags, lnotab.getCode(), self._getConsts(), - tuple(self.names), tuple(self.varnames), - self.filename, self.name, self.firstlineno, - lnotab.getTable()) + try: + co = new.code(self.argcount, nlocals, stacksize, + self.flags, lnotab.getCode(), self._getConsts(), + tuple(self.names), tuple(self.varnames), + self.filename, self.name, self.firstlineno, + lnotab.getTable()) + except SystemError, err: + print err + print repr(self.argcount) + print repr(nlocals) + print repr(stacksize) + print repr(self.flags) + print repr(lnotab.getCode()) + print repr(self._getConsts()) + print repr(self.names) + print repr(self.varnames) + print repr(self.filename) + print repr(self.name) + print repr(self.firstlineno) + print repr(lnotab.getTable()) + raise return co def _getConsts(self): -- cgit v0.12