Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8c50f93

Browse files
committed
py/runtime.h: Define mp_check_self(pred) helper macro.
Indended to replace raw asserts in bunch of files. Expands to emptyif MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG is defined, otehrwise bydefault still to assert, though a particular port may define it tosomething else.
1 parent9e1b61d commit8c50f93

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎py/runtime.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ NORETURN void mp_raise_TypeError(const char *msg);
141141
NORETURNvoidmp_not_implemented(constchar*msg);
142142
NORETURNvoidmp_exc_recursion_depth(void);
143143

144+
#ifMICROPY_BUILTIN_METHOD_CHECK_SELF_ARG
145+
#undef mp_check_self
146+
#definemp_check_self(pred)
147+
#else
148+
// A port may define to raise TypeError for example
149+
#ifndefmp_check_self
150+
#definemp_check_self(pred) assert(pred)
151+
#endif
152+
#endif
153+
144154
// helper functions for native/viper code
145155
mp_uint_tmp_convert_obj_to_native(mp_obj_tobj,mp_uint_ttype);
146156
mp_obj_tmp_convert_native_to_obj(mp_uint_tval,mp_uint_ttype);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp