| 1627 | # klass is the class to instantiate, and k points to the topmost mark |
| 1628 | # object, following which are the arguments for klass.__init__. |
| 1629 | def _instantiate(self, klass, args): |
| 1630 | if (args or not isinstance(klass, type) or |
| 1631 | hasattr(klass, "__getinitargs__")): |
| 1632 | try: |
| 1633 | value = klass(*args) |
| 1634 | except TypeError as err: |
| 1635 | raise TypeError("in constructor for %s: %s" % |
| 1636 | (klass.__name__, str(err)), err.__traceback__) |
| 1637 | else: |
| 1638 | value = klass.__new__(klass) |
| 1639 | self.append(value) |
| 1640 | |
| 1641 | def load_inst(self): |
| 1642 | module = self.readline()[:-1].decode("ascii") |