summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--locale/ID.po8
-rw-r--r--locale/circuitpython.pot16
-rw-r--r--locale/cs.po8
-rw-r--r--locale/de_DE.po8
-rw-r--r--locale/es.po8
-rw-r--r--locale/fil.po8
-rw-r--r--locale/fr.po8
-rw-r--r--locale/it_IT.po8
-rw-r--r--locale/ko.po8
-rw-r--r--locale/nl.po8
-rw-r--r--locale/pl.po8
-rw-r--r--locale/pt_BR.po8
-rw-r--r--locale/sv.po8
-rw-r--r--locale/zh_Latn_pinyin.po8
-rwxr-xr-xmain.c8
-rwxr-xr-xports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/boards/uchip/mpconfigboard.mk8
-rw-r--r--py/circuitpy_mpconfig.h5
-rw-r--r--py/objarray.c66
-rw-r--r--tools/convert_release_notes.py26
20 files changed, 187 insertions, 47 deletions
diff --git a/locale/ID.po b/locale/ID.po
index 9e10156e6..c85b8edfe 100644
--- a/locale/ID.po
+++ b/locale/ID.po
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2020-07-06 18:10+0000\n"
"Last-Translator: oon arfiandwi <oon.arfiandwi@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -111,6 +111,10 @@ msgstr "%q() mengambil posisi argumen %d tapi %d yang diberikan"
msgid "'%q' argument required"
msgstr "'%q' argumen dibutuhkan"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3137,7 +3141,7 @@ msgstr "struct: index keluar dari jangkauan"
msgid "struct: no fields"
msgstr "struct: tidak ada fields"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr ""
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index 6bdc91bf1..988f89a05 100644
--- a/locale/circuitpython.pot
+++ b/locale/circuitpython.pot
@@ -1,12 +1,14 @@
-# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
-# SPDX-License-Identifier: MIT
-
+#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -103,6 +105,10 @@ msgstr ""
msgid "'%q' argument required"
msgstr ""
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3098,7 +3104,7 @@ msgstr ""
msgid "struct: no fields"
msgstr ""
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr ""
diff --git a/locale/cs.po b/locale/cs.po
index d09cf1e94..2cecbcc10 100644
--- a/locale/cs.po
+++ b/locale/cs.po
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2020-05-24 03:22+0000\n"
"Last-Translator: dronecz <mzuzelka@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -111,6 +111,10 @@ msgstr ""
msgid "'%q' argument required"
msgstr ""
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3106,7 +3110,7 @@ msgstr ""
msgid "struct: no fields"
msgstr ""
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 1e168db52..014cd749f 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2020-06-16 18:24+0000\n"
"Last-Translator: Andreas Buchen <andreas.buchen@gmail.com>\n"
"Language: de_DE\n"
@@ -110,6 +110,10 @@ msgstr "%q() nimmt %d Argumente ohne Keyword an, aber es wurden %d angegeben"
msgid "'%q' argument required"
msgstr "'%q' Argument erforderlich"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3190,7 +3194,7 @@ msgstr "struct: index außerhalb gültigen Bereichs"
msgid "struct: no fields"
msgstr "struct: keine Felder"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr "substring nicht gefunden"
diff --git a/locale/es.po b/locale/es.po
index 0dd09a98d..2ebad85e9 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2020-07-13 19:24+0000\n"
"Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n"
@@ -115,6 +115,10 @@ msgstr "%q() toma %d argumentos posicionales pero %d fueron dados"
msgid "'%q' argument required"
msgstr "argumento '%q' requerido"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3174,7 +3178,7 @@ msgstr "struct: index fuera de rango"
msgid "struct: no fields"
msgstr "struct: sin campos"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr "substring no encontrado"
diff --git a/locale/fil.po b/locale/fil.po
index 1297ce186..e35982930 100644
--- a/locale/fil.po
+++ b/locale/fil.po
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@@ -106,6 +106,10 @@ msgstr ""
msgid "'%q' argument required"
msgstr "'%q' argument kailangan"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3153,7 +3157,7 @@ msgstr "struct: index hindi maabot"
msgid "struct: no fields"
msgstr "struct: walang fields"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr "substring hindi nahanap"
diff --git a/locale/fr.po b/locale/fr.po
index 4582974d4..6dffd41eb 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2020-06-05 17:29+0000\n"
"Last-Translator: aberwag <aberwag@gmail.com>\n"
"Language: fr\n"
@@ -115,6 +115,10 @@ msgstr "%q() prend %d arguments positionnels mais %d ont été donnés"
msgid "'%q' argument required"
msgstr "'%q' argument requis"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3197,7 +3201,7 @@ msgstr "struct : index hors limites"
msgid "struct: no fields"
msgstr "struct : aucun champs"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr "sous-chaîne non trouvée"
diff --git a/locale/it_IT.po b/locale/it_IT.po
index 235843382..92b8fbaaa 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@@ -105,6 +105,10 @@ msgstr "%q() prende %d argomenti posizionali ma ne sono stati forniti %d"
msgid "'%q' argument required"
msgstr "'%q' argomento richiesto"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3160,7 +3164,7 @@ msgstr "struct: indice fuori intervallo"
msgid "struct: no fields"
msgstr "struct: nessun campo"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr "sottostringa non trovata"
diff --git a/locale/ko.po b/locale/ko.po
index 6829f6819..8aa96e901 100644
--- a/locale/ko.po
+++ b/locale/ko.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -105,6 +105,10 @@ msgstr ""
msgid "'%q' argument required"
msgstr ""
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3103,7 +3107,7 @@ msgstr ""
msgid "struct: no fields"
msgstr ""
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr ""
diff --git a/locale/nl.po b/locale/nl.po
index d39d0bb18..253d18a04 100644
--- a/locale/nl.po
+++ b/locale/nl.po
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2020-07-13 17:39+0000\n"
"Last-Translator: _fonzlate <vooralfred@gmail.com>\n"
"Language-Team: none\n"
@@ -111,6 +111,10 @@ msgstr "%q() verwacht %d positionele argumenten maar kreeg %d"
msgid "'%q' argument required"
msgstr "'%q' argument vereist"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3162,7 +3166,7 @@ msgstr "struct: index buiten bereik"
msgid "struct: no fields"
msgstr "struct: geen velden"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr "deelreeks niet gevonden"
diff --git a/locale/pl.po b/locale/pl.po
index e8b7298a2..b2b2d7a16 100644
--- a/locale/pl.po
+++ b/locale/pl.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@@ -105,6 +105,10 @@ msgstr "%q() bierze %d argumentów pozycyjnych, lecz podano %d"
msgid "'%q' argument required"
msgstr "'%q' wymaga argumentu"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3110,7 +3114,7 @@ msgstr "struct: indeks poza zakresem"
msgid "struct: no fields"
msgstr "struct: brak pól"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr "brak pod-łańcucha"
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 024608b3d..b7062f5f0 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2020-07-09 17:23+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n"
@@ -111,6 +111,10 @@ msgstr "%q() recebe %d argumentos posicionais, porém %d foram informados"
msgid "'%q' argument required"
msgstr "'%q' argumento(s) requerido(s)"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3186,7 +3190,7 @@ msgstr "struct: índice fora do intervalo"
msgid "struct: no fields"
msgstr "struct: sem campos"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr "a substring não foi encontrada"
diff --git a/locale/sv.po b/locale/sv.po
index b588cbea7..ffec64bfe 100644
--- a/locale/sv.po
+++ b/locale/sv.po
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2020-07-13 17:39+0000\n"
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -111,6 +111,10 @@ msgstr "%q() kräver %d positionsargument men %d gavs"
msgid "'%q' argument required"
msgstr "'%q' argument krävs"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3155,7 +3159,7 @@ msgstr "struct: index utanför intervallet"
msgid "struct: no fields"
msgstr "struct: inga fält"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr "det gick inte att hitta delsträng"
diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po
index 0f6d55fd1..6c19fb67c 100644
--- a/locale/zh_Latn_pinyin.po
+++ b/locale/zh_Latn_pinyin.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-07 14:38-0500\n"
+"POT-Creation-Date: 2020-07-17 18:03-0700\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@@ -111,6 +111,10 @@ msgstr "%q() cǎiyòng %d wèizhì cānshù, dàn gěi chū %d"
msgid "'%q' argument required"
msgstr "xūyào '%q' cānshù"
+#: py/objarray.c
+msgid "'%q' object is not bytes-like"
+msgstr ""
+
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@@ -3140,7 +3144,7 @@ msgstr "jiégòu: suǒyǐn chāochū fànwéi"
msgid "struct: no fields"
msgstr "jiégòu: méiyǒu zìduàn"
-#: py/objstr.c
+#: py/objarray.c py/objstr.c
msgid "substring not found"
msgstr "wèi zhǎodào zi zìfú chuàn"
diff --git a/main.c b/main.c
index f928d0d62..a571c547a 100755
--- a/main.c
+++ b/main.c
@@ -97,6 +97,10 @@ void do_str(const char *src, mp_parse_input_kind_t input_kind) {
}
}
+#if MICROPY_ENABLE_PYSTACK
+static size_t PLACE_IN_DTCM_BSS(_pystack[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]);
+#endif
+
void start_mp(supervisor_allocation* heap) {
reset_status_led();
autoreload_stop();
@@ -125,6 +129,10 @@ void start_mp(supervisor_allocation* heap) {
// Clear the readline history. It references the heap we're about to destroy.
readline_init0();
+ #if MICROPY_ENABLE_PYSTACK
+ mp_pystack_init(_pystack, _pystack + (sizeof(_pystack) / sizeof(size_t)));
+ #endif
+
#if MICROPY_ENABLE_GC
gc_init(heap->ptr, heap->ptr + heap->length / 4);
#endif
diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk
index da5f1ffac..619b7d694 100755
--- a/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/mpconfigboard.mk
@@ -12,6 +12,7 @@ EXTERNAL_FLASH_DEVICES = "W25Q32JV_IQ"
LONGINT_IMPL = MPZ
CIRCUITPY_BITBANGIO = 0
+CIRCUITPY_COUNTIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_VECTORIO = 0
diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.mk b/ports/atmel-samd/boards/uchip/mpconfigboard.mk
index 196068a1e..d08690a15 100644
--- a/ports/atmel-samd/boards/uchip/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/uchip/mpconfigboard.mk
@@ -10,9 +10,7 @@ INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
-# Tweak inlining depending on language.
-ifeq ($(TRANSLATION), zh_Latn_pinyin)
+# Always use aggressive inlining
CFLAGS_INLINE_LIMIT = 45
-else
-CFLAGS_INLINE_LIMIT = 70
-endif
+
+SUPEROPT_GC = 0
diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index d05a246fc..a7853fabd 100644
--- a/py/circuitpy_mpconfig.h
+++ b/py/circuitpy_mpconfig.h
@@ -119,6 +119,7 @@
#define MICROPY_QSTR_BYTES_IN_HASH (1)
#define MICROPY_REPL_AUTO_INDENT (1)
#define MICROPY_REPL_EVENT_DRIVEN (0)
+#define MICROPY_ENABLE_PYSTACK (1)
#define MICROPY_STACK_CHECK (1)
#define MICROPY_STREAMS_NON_BLOCK (1)
#ifndef MICROPY_USE_INTERNAL_PRINTF
@@ -785,6 +786,10 @@ void supervisor_run_background_tasks_if_tick(void);
#define CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS 1000
#endif
+#ifndef CIRCUITPY_PYSTACK_SIZE
+#define CIRCUITPY_PYSTACK_SIZE 1024
+#endif
+
#define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt"
#define CIRCUITPY_VERBOSE_BLE 0
diff --git a/py/objarray.c b/py/objarray.c
index 7dfdc5b12..5d83f0697 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -400,6 +400,66 @@ STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in) {
STATIC MP_DEFINE_CONST_FUN_OBJ_2(array_extend_obj, array_extend);
#endif
+#if MICROPY_PY_BUILTINS_BYTEARRAY && MICROPY_CPYTHON_COMPAT
+STATIC mp_obj_t buffer_finder(size_t n_args, const mp_obj_t *args, int direction, bool is_index) {
+ mp_check_self(MP_OBJ_IS_TYPE(args[0], &mp_type_bytearray));
+ const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
+
+ mp_buffer_info_t haystack_bufinfo;
+ mp_get_buffer_raise(args[0], &haystack_bufinfo, MP_BUFFER_READ);
+
+ mp_buffer_info_t needle_bufinfo;
+ mp_get_buffer_raise(args[1], &needle_bufinfo, MP_BUFFER_READ);
+
+ if (mp_binary_get_size('@', needle_bufinfo.typecode, NULL) != 1) {
+ mp_raise_TypeError(translate("a bytes-like object is required"));
+ }
+
+ const byte *start = haystack_bufinfo.buf;
+ const byte *end = ((const byte*)haystack_bufinfo.buf) + haystack_bufinfo.len;
+ if (n_args >= 3 && args[2] != mp_const_none) {
+ start += mp_get_index(self_type, haystack_bufinfo.len, args[2], true);
+ }
+ if (n_args >= 4 && args[3] != mp_const_none) {
+ end = ((const byte*)haystack_bufinfo.buf) + mp_get_index(self_type, haystack_bufinfo.len, args[3], true);
+ }
+
+ const byte *p = NULL;
+ if (end >= start) {
+ p = find_subbytes(start, end - start, needle_bufinfo.buf, needle_bufinfo.len, direction);
+ }
+
+ if (p == NULL) {
+ if (is_index) {
+ mp_raise_ValueError(translate("substring not found"));
+ } else {
+ return MP_OBJ_NEW_SMALL_INT(-1);
+ }
+ }
+ return MP_OBJ_NEW_SMALL_INT(p - (const byte*) haystack_bufinfo.buf);
+}
+
+STATIC mp_obj_t buffer_find(size_t n_args, const mp_obj_t *args) {
+ return buffer_finder(n_args, args, 1, false);
+}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_find_obj, 2, 4, buffer_find);
+
+STATIC mp_obj_t buffer_rfind(size_t n_args, const mp_obj_t *args) {
+ return buffer_finder(n_args, args, -1, false);
+}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_rfind_obj, 2, 4, buffer_rfind);
+
+STATIC mp_obj_t buffer_index(size_t n_args, const mp_obj_t *args) {
+ return buffer_finder(n_args, args, 1, true);
+}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_index_obj, 2, 4, buffer_index);
+
+STATIC mp_obj_t buffer_rindex(size_t n_args, const mp_obj_t *args) {
+ return buffer_finder(n_args, args, -1, true);
+}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(buffer_rindex_obj, 2, 4, buffer_rindex);
+#endif
+
STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
// delete item
@@ -580,7 +640,13 @@ STATIC MP_DEFINE_CONST_DICT(array_locals_dict, array_locals_dict_table);
STATIC const mp_rom_map_elem_t bytearray_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&array_append_obj) },
{ MP_ROM_QSTR(MP_QSTR_extend), MP_ROM_PTR(&array_extend_obj) },
+
#if MICROPY_CPYTHON_COMPAT
+ { MP_ROM_QSTR(MP_QSTR_find), MP_ROM_PTR(&buffer_find_obj) },
+ { MP_ROM_QSTR(MP_QSTR_rfind), MP_ROM_PTR(&buffer_rfind_obj) },
+ { MP_ROM_QSTR(MP_QSTR_index), MP_ROM_PTR(&buffer_index_obj) },
+ { MP_ROM_QSTR(MP_QSTR_rindex), MP_ROM_PTR(&buffer_rindex_obj) },
+
{ MP_ROM_QSTR(MP_QSTR_decode), MP_ROM_PTR(&array_decode_obj) },
#endif
};
diff --git a/tools/convert_release_notes.py b/tools/convert_release_notes.py
index 4b16f005e..797e71834 100644
--- a/tools/convert_release_notes.py
+++ b/tools/convert_release_notes.py
@@ -4,13 +4,14 @@
import sys
import mistune
+import mistune.renderers
print(sys.argv[1])
with open(sys.argv[1], "r") as source_file:
source = source_file.read()
-html = mistune.Markdown()
+html = mistune.create_markdown()
print()
print("HTML")
@@ -19,39 +20,39 @@ print("From the <a href=\"\">GitHub release page</a>:\n<blockquote>")
print(html(source))
print("</blockquote>")
-class AdafruitBBCodeRenderer:
- def __init__(self, **kwargs):
- self.options = kwargs
-
+class AdafruitBBCodeRenderer(mistune.renderers.BaseRenderer):
def placeholder(self):
return ''
def paragraph(self, text):
return text + "\n\n"
+ def block_text(self, text):
+ return text
+
def text(self, text):
return text
def link(self, link, title, text):
- return "[url={}]{}[/url]".format(link, text)
+ return "[url={}]{}[/url]".format(link, title)
def autolink(self, link, is_email):
if not is_email:
return "[url={}]{}[/url]".format(link, link)
return link
- def header(self, text, level, raw):
+ def heading(self, text, level):
return "[b][size=150]{}[/size][/b]\n".format(text)
def codespan(self, text):
return "[color=#E74C3C][size=95]{}[/size][/color]".format(text)
- def list_item(self, text):
+ def list_item(self, text, level):
return "[*]{}[/*]\n".format(text.strip())
- def list(self, body, ordered=True):
+ def list(self, text, ordered, level, start=None):
ordered_indicator = "=" if ordered else ""
- return "[list{}]\n{}[/list]".format(ordered_indicator, body)
+ return "[list{}]\n{}[/list]".format(ordered_indicator, text)
def double_emphasis(self, text):
return "[b]{}[/b]".format(text)
@@ -59,7 +60,10 @@ class AdafruitBBCodeRenderer:
def emphasis(self, text):
return "[b]{}[/b]".format(text)
-bbcode = mistune.Markdown(renderer=AdafruitBBCodeRenderer())
+ def strong(self, text):
+ return "[i]{}[/i]".format(text)
+
+bbcode = mistune.create_markdown(renderer=AdafruitBBCodeRenderer())
print()
print("BBCode")