Compare commits

...

6 commits

Author SHA1 Message Date
79a686eb95 run-tests: set python stdio encoding to utf-8 2018-03-31 11:41:00 -05:00
ed3f0c4ff5 run-tests: Pass SYSTEMROOT on Windows if set
.. unsetting this causes python3 to fail to start at all,
stating "Fatal Python error: Failed to initialize Windows random API
(CryptoGen)".  See https://bugs.python.org/issue20614
2018-03-31 11:11:05 -05:00
264cb9c65e py/argcheck: Add ifdef guards to gcc-specific code 2018-03-31 11:03:54 -05:00
099f4b2e5c py/nlr: Avoid redefinition warning 2018-03-31 11:03:21 -05:00
220c641702 py/stacktrl: Add ifdef guards to gcc-specific code
(different tricks may be required to fully avoid inlining of these
functions on other compilers, however)
2018-03-31 10:59:34 -05:00
1152f3d1c4 py/persistentcode: Don't use VLA except on gnuc
.. on other platforms, alloca can be used as an alternative.
(micropython uses m_new + m_del but this seems unnecessary as alloca
is already required by micropyton)
2018-03-31 10:58:49 -05:00
5 changed files with 15 additions and 1 deletions

View file

@ -32,7 +32,9 @@
void mp_arg_check_num(size_t n_args, size_t n_kw, size_t n_args_min, size_t n_args_max, bool takes_kw) {
// NOTE(tannewt): This prevents this function from being optimized away.
// Without it, functions can crash when reading invalid args.
#ifdef __GNUC__
__asm volatile ("");
#endif
// TODO maybe take the function name as an argument so we can print nicer error messages
if (n_kw && !takes_kw) {

View file

@ -55,6 +55,7 @@ struct _nlr_buf_t {
#elif defined(__xtensa__)
void *regs[10];
#else
#undef MICROPY_NLR_SETJMP
#define MICROPY_NLR_SETJMP (1)
//#warning "No native NLR support for this arch, using setjmp implementation"
#endif

View file

@ -124,7 +124,11 @@ STATIC size_t read_uint(mp_reader_t *reader) {
STATIC qstr load_qstr(mp_reader_t *reader) {
size_t len = read_uint(reader);
#ifdef __GNUC__
char str[len];
#else
char *str = alloca(len);
#endif
read_bytes(reader, (byte*)str, len);
qstr qst = qstr_from_strn(str, len);
return qst;

View file

@ -29,7 +29,9 @@
void mp_stack_ctrl_init(void) {
// Force routine to not be inlined. Better guarantee than MP_NOINLINE for -flto.
#ifdef __GNUC__
__asm volatile ("");
#endif
volatile int stack_dummy;
MP_STATE_THREAD(stack_top) = (char*)&stack_dummy;
}
@ -41,7 +43,9 @@ void mp_stack_set_top(void *top) {
mp_uint_t mp_stack_usage(void) {
// Assumes descending stack
// Force routine to not be inlined. Better guarantee than MP_NOINLINE for -flto.
#ifdef __GNUC__
__asm volatile ("");
#endif
volatile int stack_dummy;
return MP_STATE_THREAD(stack_top) - (char*)&stack_dummy;
}

View file

@ -389,7 +389,10 @@ def run_tests(pyb, tests, args, base_path="."):
# run CPython to work out expected output
e = {"PYTHONPATH": os.getcwd(),
"PATH": os.environ["PATH"],
"LANG": "en_US.UTF-8"}
"LANG": "en_US.UTF-8",
"PYTHONIOENCODING": "utf-8"}
if 'SYSTEMROOT' in os.environ:
e['SYSTEMROOT'] = os.environ['SYSTEMROOT']
p = subprocess.Popen([CPYTHON3, '-B', test_file], env=e, stdout=subprocess.PIPE)
output_expected = b''
while p.poll() is None: