8000 Merge pull request #1975 from tannewt/merge_in_402 · adafruit/circuitpython@f0a112e · GitHub
[go: up one dir, main page]

Skip to content

Commit f0a112e

Browse files
authored
Merge pull request #1975 from tannewt/merge_in_402
Merge in 4.0.2
2 parents 72ea216 + 0cce7fc commit f0a112e

21 files changed

+151
-31
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ addons:
3333
- $(ls -d1 bin/*/*/* | tr "\n" ":")
3434
target_paths: /
3535

36+
# Some deploy jobs take over 10 minutes so use this keep alive hack to make sure Travis doesn't kill us.
37+
before_deploy: |
38+
function keep_alive() {
39+
while true; do
40+
echo -en "\a"
41+
sleep 5
42+
done
43+
}
44+
keep_alive &
45+
3646
deploy:
3747
provider: releases
3848
api_key:

locale/ID.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2019-06-11 14:59-0700\n"
11+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -460,6 +460,14 @@ msgstr ""
460460
msgid "Command must be an int between 0 and 255"
461461
msgstr ""
462462

463+
#: py/persistentcode.c
464+
msgid "Corrupt .mpy file"
465+
msgstr ""
466+
467+
#: py/emitglue.c
468+
msgid "Corrupt raw code"
469+
msgstr ""
470+
463471
#: ports/nrf/common-hal/bleio/UUID.c
464472
#, c-format
465473
msgid "Could not decode ble_uuid, err 0x%04x"

locale/circuitpython.pot

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2019-06-12 00:59-0700\n"
11+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -450,6 +450,14 @@ msgstr ""
450450
msgid "Command must be an int between 0 and 255"
451451
msgstr ""
452452

453+
#: py/persistentcode.c
454+
msgid "Corrupt .mpy file"
455+
msgstr ""
456+
457+
#: py/emitglue.c
458+
msgid "Corrupt raw code"
459+
msgstr ""
460+
453461
#: ports/nrf/common-hal/bleio/UUID.c
454462
#, c-format
455463
msgid "Could not decode ble_uuid, err 0x%04x"

locale/de_DE.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2019-06-11 14:59-0700\n"
10+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1111
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
1212
"Last-Translator: Pascal Deneaux\n"
1313
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@@ -454,6 +454,14 @@ msgstr ""
454454
msgid "Command must be an int between 0 and 255"
455455
msgstr "Der Befehl muss ein int zwischen 0 und 255 sein"
456456

457+
#: py/persistentcode.c
458+
msgid "Corrupt .mpy file"
459+
msgstr ""
460+
461+
#: py/emitglue.c
462+
msgid "Corrupt raw code"
463+
msgstr ""
464+
457465
#: ports/nrf/common-hal/bleio/UUID.c
458466
#, c-format
459467
msgid "Could not decode ble_uuid, err 0x%04x"

locale/en_US.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2019-06-11 14:59-0700\n"
10+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1111
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
1212
"Last-Translator: \n"
1313
"Language-Team: \n"
@@ -450,6 +450,14 @@ msgstr ""
450450
msgid "Command must be an int between 0 and 255"
451451
msgstr ""
452452

453+
#: py/persistentcode.c
454+
msgid "Corrupt .mpy file"
455+
msgstr ""
456+
457+
#: py/emitglue.c
458+
msgid "Corrupt raw code"
459+
msgstr ""
460+
453461
#: ports/nrf/common-hal/bleio/UUID.c
454462
#, c-format
455463
msgid "Could not decode ble_uuid, err 0x%04x"

locale/en_x_pirate.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2019-06-11 14:59-0700\n"
10+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1111
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
1212
"Last-Translator: \n"
1313
"Language-Team: @sommersoft, @MrCertainly\n"
@@ -454,6 +454,14 @@ msgstr ""
454454
msgid "Command must be an int between 0 and 255"
455455
msgstr ""
456456

457+
#: py/persistentcode.c
458+
msgid "Corrupt .mpy file"
459+
msgstr ""
460+
461+
#: py/emitglue.c
462+
msgid "Corrupt raw code"
463+
msgstr ""
464+
457465
#: ports/nrf/common-hal/bleio/UUID.c
458466
#, c-format
459467
msgid "Could not decode ble_uuid, err 0x%04x"

locale/es.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2019-06-15 09:21-0500\n"
10+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1111
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
1212
"Last-Translator: \n"
1313
"Language-Team: \n"
@@ -452,6 +452,14 @@ msgstr "Entrada de columna debe ser digitalio.DigitalInOut"
452452
msgid "Command must be an int between 0 and 255"
453453
msgstr "Command debe estar entre 0 y 255."
454454

455+
#: py/persistentcode.c
456+
msgid "Corrupt .mpy file"
457+
msgstr ""
458+
459+
#: py/emitglue.c
460+
msgid "Corrupt raw code"
461+
msgstr ""
462+
455463
#: ports/nrf/common-hal/bleio/UUID.c
456464
#, c-format
457465
msgid "Could not decode ble_uuid, err 0x%04x"

locale/fil.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2019-06-11 14:59-0700\n"
10+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1111
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
1212
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
1313
"Language-Team: fil\n"
@@ -459,6 +459,14 @@ msgstr ""
459459
msgid "Command must be an int between 0 and 255"
460460
msgstr "Sa gitna ng 0 o 255 dapat ang bytes."
461461

462+
#: py/persistentcode.c
463+
msgid "Corrupt .mpy file"
464+
msgstr ""
465+
466+
#: py/emitglue.c
467+
msgid "Corrupt raw code"
468+
msgstr ""
469+
462470
#: ports/nrf/common-hal/bleio/UUID.c
463471
#, c-format
464472
msgid "Could not decode ble_uuid, err 0x%04x"

locale/fr.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: 0.1\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2019-06-11 14:59-0700\n"
11+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1212
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
1313
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
1414
"Language-Team: fr\n"
@@ -465,6 +465,14 @@ msgstr "L'entrée 'Column' doit être un digitalio.DigitalInOut"
465465
msgid "Command must be an int between 0 and 255"
466466
msgstr "La commande doit être un entier entre 0 et 255"
467467

468+
#: py/persistentcode.c
469+
msgid "Corrupt .mpy file"
470+
msgstr ""
471+
472+
#: py/emitglue.c
473+
msgid "Corrupt raw code"
474+
msgstr ""
475+
468476
#: ports/nrf/common-hal/bleio/UUID.c
469477
#, c-format
470 10000 478
msgid "Could not decode ble_uuid, err 0x%04x"

locale/it_IT.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2019-06-11 14:59-0700\n"
11+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1212
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
1313
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
1414
"Language-Team: \n"
@@ -460,6 +460,14 @@ msgstr ""
460460
msgid "Command must be an int between 0 and 255"
461461
msgstr "I byte devono essere compresi tra 0 e 255"
462462

463+
#: py/persistentcode.c
464+
msgid "Corrupt .mpy file"
465+
msgstr ""
466+
467+
#: py/emitglue.c
468+
msgid "Corrupt raw code"
469+
msgstr ""
470+
463471
#: ports/nrf/common-hal/bleio/UUID.c
464472
#, c-format
465473
msgid "Could not decode ble_uuid, err 0x%04x"

locale/pl.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2019-06-11 14:59-0700\n"
10+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1111
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
1212
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
1313
"Language-Team: pl\n"
@@ -453,6 +453,14 @@ msgstr "Kolumny muszą być typu digitalio.DigitalInOut"
4 10000 53453
msgid "Command must be an int between 0 and 255"
454454
msgstr "Komenda musi być int pomiędzy 0 a 255"
455455

456+
#: py/persistentcode.c
457+
msgid "Corrupt .mpy file"
458+
msgstr ""
459+
460+
#: py/emitglue.c
461+
msgid "Corrupt raw code"
462+
msgstr ""
463+
456464
#: ports/nrf/common-hal/bleio/UUID.c
457465
#, c-format
458466
msgid "Could not decode ble_uuid, err 0x%04x"

locale/pt_BR.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2019-06-11 14:59-0700\n"
11+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1212
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
1313
"Last-Translator: \n"
1414
"Language-Team: \n"
@@ -456,6 +456,14 @@ msgstr ""
456456
msgid "Command must be an int between 0 and 255"
457457
msgstr "Os bytes devem estar entre 0 e 255."
458458

459+
#: py/persistentcode.c
460+
msgid "Corrupt .mpy file"
461+
msgstr ""
462+
463+
#: py/emitglue.c
464+
msgid "Corrupt raw code"
465+
msgstr ""
466+
459467
#: ports/nrf/common-hal/bleio/UUID.c
460468
#, c-format
461469
msgid "Could not decode ble_uuid, err 0x%04x"

locale/zh_Latn_pinyin.po

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: circuitpython-cn\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2019-06-11 14:59-0700\n"
10+
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
1111
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
1212
"Last-Translator: hexthat\n"
1313
"Language-Team: Chinese Hanyu Pinyin\n"
@@ -454,6 +454,14 @@ msgstr "Liè tiáomù bìxū shì digitalio.DigitalInOut"
454454
msgid "Command must be an int between 0 and 255"
455455
msgstr "Mìnglìng bìxū shì 0 dào 255 zhī jiān de int"
456456

457+
#: py/persistentcode.c
458+
msgid "Corrupt .mpy file"
459+
msgstr ""
460+
461+
#: py/emitglue.c
462+
msgid "Corrupt raw code"
463+
msgstr ""
464+
457465
#: ports/nrf/common-hal/bleio/UUID.c
458466
#, c-format
459467
msgid "Could not decode ble_uuid, err 0x%04x"

ports/atmel-samd/boards/pirkey_m0/pins.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
55

66
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) },
77
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) },
8-
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
9-
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
10-
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
118
};
129
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

py/emitglue.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,12 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_ar
142142
fun = mp_obj_new_fun_asm(rc->n_pos_args, rc->data.u_native.fun_data, rc->data.u_native.type_sig);
143143
break;
144144
#endif
145-
default:
146-
// rc->kind should always be set and BYTECODE is the only remaining case
147-
assert(rc->kind == MP_CODE_BYTECODE);
145+
case MP_CODE_BYTECODE:
148146
fun = mp_obj_new_fun_bc(def_args, def_kw_args, rc->data.u_byte.bytecode, rc->data.u_byte.const_table);
149147
break;
148+
default:
149+
// All other kinds are invalid.
150+
mp_raise_RuntimeError(translate("Corrupt raw code"));
150151
}
151152

152153
// check for generator functions and if so wrap in generator object

py/persistentcode.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,35 @@ STATIC void extract_prelude(const byte **ip, const byte **ip2, bytecode_prelude_
102102

103103
#include "py/parsenum.h"
104104

105+
STATIC void raise_corrupt_mpy(void) {
106+
mp_raise_RuntimeError(translate("Corrupt .mpy file"));
107+
}
108+
105109
STATIC int read_byte(mp_reader_t *reader) {
106-
return reader->readbyte(reader->data);
110+
mp_uint_t b = reader->readbyte(reader->data);
111+
if (b == MP_READER_EOF) {
112+
raise_corrupt_mpy();
113+
}
114+
return b;
107115
}
108116

109117
STATIC void read_bytes(mp_reader_t *reader, byte *buf, size_t len) {
110118
while (len-- > 0) {
111-
*buf++ = reader->readbyte(reader->data);
119+
mp_uint_t b =reader->readbyte(reader->data);
120+
if (b == MP_READER_EOF) {
121+
raise_corrupt_mpy();
122+
}
123+
*buf++ = b;
112124
}
113125
}
114126

115127
STATIC size_t read_uint(mp_reader_t *reader) {
116128
size_t unum = 0;
117129
for (;;) {
118-
byte b = reader->readbyte(reader->data);
130+
mp_uint_t b = reader->readbyte(reader->data);
131+
if (b == MP_READER_EOF) {
132+
raise_corrupt_mpy();
133+
}
119134
unum = (unum << 7) | (b & 0x7f);
120135
if ((b & 0x80) == 0) {
121136
break;
@@ -145,11 +160,12 @@ STATIC mp_obj_t load_obj(mp_reader_t *reader) {
145160
return mp_obj_new_str_from_vstr(obj_type == 's' ? &mp_type_str : &mp_type_bytes, &vstr);
146161
} else if (obj_type == 'i') {
147162
return mp_parse_num_integer(vstr.buf, vstr.len, 10, NULL);
148-
} else {
149-
assert(obj_type == 'f' || obj_type == 'c');
163+
} else if (obj_type == 'f' || obj_type == 'c') {
150164
return mp_parse_num_decimal(vstr.buf, vstr.len, obj_type == 'c', false, NULL);
151165
}
152166
}
167+
raise_corrupt_mpy();
168+
return MP_OBJ_FROM_PTR(&mp_const_none_obj);
153169
}
154170

155171
STATIC void load_bytecode_qstrs(mp_reader_t *reader, byte *ip, byte *ip_top) {

0 commit comments

Comments
 (0)
0