pypy /pypy/rlib/rstruct/error.py

Language Python Lines 23
MD5 Hash a33b02a2dbb7127626c438ce5827aa09 Estimated Cost $306 (why?)
Repository https://bitbucket.org/dac_io/pypy View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class StructError(Exception):
    "Interp-level error that gets mapped to an app-level struct.error."

    def __init__(self, msg):
        self.msg = msg

    def __str__(self):
        return self.msg

    def at_applevel(self, space):
        from pypy.interpreter.error import OperationError
        w_module = space.getbuiltinmodule('struct')
        w_error = space.getattr(w_module, space.wrap('error'))
        return OperationError(w_error, space.wrap(self.msg))


class StructOverflowError(StructError):

    def at_applevel(self, space):
        from pypy.interpreter.error import OperationError
        return OperationError(space.w_OverflowError, space.wrap(self.msg))
Back to Top