1.1 --- a/templates/ops.c Sat Nov 26 23:07:09 2016 +0100
1.2 +++ b/templates/ops.c Sun Nov 27 00:33:50 2016 +0100
1.3 @@ -41,6 +41,14 @@
1.4 return 1;
1.5 }
1.6
1.7 +int __get_class_and_store(__ref obj, int pos, __attr value)
1.8 +{
1.9 + /* Forbid class-relative assignments. */
1.10 +
1.11 + __raise_type_error();
1.12 + return 0;
1.13 +}
1.14 +
1.15 /* Introspection. */
1.16
1.17 int __is_instance(__ref obj)
1.18 @@ -124,6 +132,14 @@
1.19
1.20 /* Attribute testing and storage operations. */
1.21
1.22 +int __check_and_store_via_class(__ref obj, int pos, int code, __attr value)
1.23 +{
1.24 + /* Forbid class-relative assignments. */
1.25 +
1.26 + __raise_type_error();
1.27 + return 0;
1.28 +}
1.29 +
1.30 int __check_and_store_via_object(__ref obj, int pos, int code, __attr value)
1.31 {
1.32 if (__HASATTR(obj, pos, code))
1.33 @@ -131,6 +147,10 @@
1.34 __store_via_object(obj, pos, value);
1.35 return 1;
1.36 }
1.37 +
1.38 + /* No suitable attribute. */
1.39 +
1.40 + __raise_type_error();
1.41 return 0;
1.42 }
1.43
1.44 @@ -138,7 +158,11 @@
1.45 {
1.46 if (__check_and_store_via_object(obj, pos, code, value))
1.47 return 1;
1.48 - return __check_and_store_via_object(__get_class(obj), pos, code, value);
1.49 +
1.50 + /* Forbid class-relative assignments. */
1.51 +
1.52 + __raise_type_error();
1.53 + return 0;
1.54 }
1.55
1.56 /* Context-related operations. */