Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
3556e457
Commit
3556e457
authored
Oct 07, 2014
by
Dave Hylands
Browse files
Allow real memory errors (from locked gc) to be reported with traceback.
parent
67f25dfe
Changes
3
Hide whitespace changes
Inline
Side-by-side
py/runtime.c
View file @
3556e457
...
...
@@ -51,6 +51,7 @@
#include
"parsehelper.h"
#include
"compile.h"
#include
"stackctrl.h"
#include
"gc.h"
#if 0 // print debugging info
#define DEBUG_PRINT (1)
...
...
@@ -1207,7 +1208,13 @@ mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_i
void
*
m_malloc_fail
(
size_t
num_bytes
)
{
DEBUG_printf
(
"memory allocation failed, allocating "
UINT_FMT
" bytes
\n
"
,
num_bytes
);
nlr_raise
((
mp_obj_t
)
&
mp_const_MemoryError_obj
);
if
(
gc_is_locked
())
{
nlr_raise
(
mp_obj_new_exception_msg
(
&
mp_type_MemoryError
,
"memory allocation failed, heap is locked"
));
}
else
{
nlr_raise
(
mp_obj_new_exception_msg_varg
(
&
mp_type_MemoryError
,
"memory allocation failed, allocating "
UINT_FMT
" bytes"
,
num_bytes
));
}
}
NORETURN
void
mp_not_implemented
(
const
char
*
msg
)
{
...
...
stmhal/printf.c
View file @
3556e457
...
...
@@ -67,8 +67,9 @@ int vprintf(const char *fmt, va_list ap) {
}
#if MICROPY_DEBUG_PRINTERS
mp_uint_t
mp_verbose_flag
=
1
;
int
DEBUG_printf
(
const
char
*
fmt
,
...)
{
(
void
)
stream
;
va_list
ap
;
va_start
(
ap
,
fmt
);
int
ret
=
pfenv_vprintf
(
&
pfenv_stdout
,
fmt
,
ap
);
...
...
unix/mpconfigport.h
View file @
3556e457
...
...
@@ -72,7 +72,7 @@
#endif
#define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1)
#define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (
128
)
#define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (
256
)
extern
const
struct
_mp_obj_module_t
mp_module_os
;
extern
const
struct
_mp_obj_module_t
mp_module_time
;
...
...
Damien George
@dpgeorge
mentioned in commit
73d1d20b
·
Feb 19, 2018
mentioned in commit
73d1d20b
mentioned in commit 73d1d20b46dda54340ad2819b865f47ca25f4850
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment