# HG changeset patch # User Paul Boddie # Date 1479576654 -3600 # Node ID 828aa694a1a12397bbfe997604c2475b5b531aa6 # Parent ce8dad96da12a77cbdf57758861b842695b29fc7 Added a special exception for the attempted invocation of unbound methods. diff -r ce8dad96da12 -r 828aa694a1a1 lib/__builtins__/core.py --- a/lib/__builtins__/core.py Sat Nov 19 18:17:54 2016 +0100 +++ b/lib/__builtins__/core.py Sat Nov 19 18:30:54 2016 +0100 @@ -59,6 +59,7 @@ class BaseException(object): pass class Exception(BaseException): pass +class UnboundMethodInvocation(Exception): pass class Warning(object): pass def get_using(callable, instance): pass diff -r ce8dad96da12 -r 828aa694a1a1 templates/progops.c --- a/templates/progops.c Sat Nov 19 18:17:54 2016 +0100 +++ b/templates/progops.c Sat Nov 19 18:30:54 2016 +0100 @@ -8,7 +8,7 @@ #include "progops.h" #include "progtypes.h" #include "main.h" -#include +#include "exceptions.h" /* Generic instantiation operations, defining common members. */ @@ -124,10 +124,10 @@ __attr __unbound_method(__attr args[]) { - /* NOTE: Should raise an exception. */ - - fprintf(stderr, "Unbound method called!\n"); - exit(1); + __attr excargs[1]; + __attr exc = __new___builtins___core_UnboundMethodInvocation(excargs); + __Raise(exc); + return __builtins___none_None; /* superfluous */ } /* Generic operations depending on specific program details. */