Skip to content

Commit 4b3da60

Browse files
committed
py/runtime: mp_raise_msg(): Accept NULL argument for message.
In this case, raise an exception without a message. This would allow to shove few code bytes comparing to currently used mp_raise_msg(..., "") pattern. (Actual savings depend on function code alignment used by a particular platform.)
1 parent 6771adc commit 4b3da60

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

py/runtime.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,11 @@ void *m_malloc_fail(size_t num_bytes) {
14311431
}
14321432

14331433
NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const char *msg) {
1434-
nlr_raise(mp_obj_new_exception_msg(exc_type, msg));
1434+
if (msg == NULL) {
1435+
nlr_raise(mp_obj_new_exception(exc_type));
1436+
} else {
1437+
nlr_raise(mp_obj_new_exception_msg(exc_type, msg));
1438+
}
14351439
}
14361440

14371441
NORETURN void mp_raise_ValueError(const char *msg) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy