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
f065344d
Commit
f065344d
authored
Jul 01, 2014
by
Damien George
Browse files
Merge branch 'preserve-except' of github.com:dhylands/micropython into dhylands-preserve-except
parents
aa47f396
2fe841d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
py/gc.c
View file @
f065344d
...
...
@@ -172,6 +172,10 @@ void gc_unlock(void) {
gc_lock_depth
--
;
}
bool
gc_is_locked
(
void
)
{
return
gc_lock_depth
!=
0
;
}
#define VERIFY_PTR(ptr) ( \
(ptr & (BYTES_PER_BLOCK - 1)) == 0
/* must be aligned on a block */
\
&& ptr >= (machine_uint_t)gc_pool_start
/* must be above start of pool */
\
...
...
py/gc.h
View file @
f065344d
...
...
@@ -30,6 +30,7 @@ void gc_init(void *start, void *end);
// They can be used to prevent the GC from allocating/freeing.
void
gc_lock
(
void
);
void
gc_unlock
(
void
);
bool
gc_is_locked
(
void
);
// A given port must implement gc_collect by using the other collect functions.
void
gc_collect
(
void
);
...
...
py/objexcept.c
View file @
f065344d
...
...
@@ -37,6 +37,7 @@
#include
"objtype.h"
#include
"runtime.h"
#include
"runtime0.h"
#include
"gc.h"
typedef
struct
_mp_obj_exception_t
{
mp_obj_base_t
base
;
...
...
@@ -335,6 +336,10 @@ void mp_obj_exception_clear_traceback(mp_obj_t self_in) {
}
void
mp_obj_exception_add_traceback
(
mp_obj_t
self_in
,
qstr
file
,
machine_uint_t
line
,
qstr
block
)
{
if
(
gc_is_locked
())
{
// We can't allocate memory, so don't bother to try
return
;
}
GET_NATIVE_EXCEPTION
(
self
,
self_in
);
// for traceback, we are just using the list object for convenience, it's not really a list of Python objects
...
...
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