From f1c0af711eddda6adbe31f64884a0c259d32b57a Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Sun, 10 Jul 2022 16:09:32 +0900 Subject: [PATCH] Cache __format__ method --- src/kuroko/object.h | 1 + src/methods.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/kuroko/object.h b/src/kuroko/object.h index 984c216..759cbaf 100644 --- a/src/kuroko/object.h +++ b/src/kuroko/object.h @@ -238,6 +238,7 @@ typedef struct KrkClass { KrkObj * _matmul, * _rmatmul, * _imatmul; KrkObj * _pos; KrkObj * _setattr; + KrkObj * _format; } KrkClass; /** diff --git a/src/methods.h b/src/methods.h index 0fa2e31..e1d58c0 100644 --- a/src/methods.h +++ b/src/methods.h @@ -46,6 +46,7 @@ CACHED_METHOD(NEGATE, "__neg__", _negate) CACHED_METHOD(SETNAME, "__set_name__", _set_name) CACHED_METHOD(POS, "__pos__", _pos) CACHED_METHOD(SETATTR, "__setattr__", _setattr) +CACHED_METHOD(FORMAT, "__format__", _format) /* These are not methods */ SPECIAL_ATTRS(CLASS, "__class__")