summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2020-08-02 11:36:38 -0400
committerDan Halbert <halbert@halwitz.org>2020-08-02 11:36:38 -0400
commit0a60aee3e4270d1da42d67f933578d60d56b8b52 (patch)
tree43beede01b4f2d94863f979365c08db64c6be882 /py
parenta76ad3415c6aeae7bb9c915f20220d32001e8094 (diff)
parente7a78e08479e412dda16076986924e3b8cb19b75 (diff)
wip: compiles
Diffstat (limited to 'py')
-rw-r--r--py/argcheck.c2
-rw-r--r--py/asmarm.c2
-rw-r--r--py/asmarm.h2
-rw-r--r--py/asmbase.c2
-rw-r--r--py/asmbase.h2
-rw-r--r--py/asmthumb.c2
-rw-r--r--py/asmthumb.h2
-rw-r--r--py/asmx64.c2
-rw-r--r--py/asmx64.h2
-rw-r--r--py/asmx86.c2
-rw-r--r--py/asmx86.h2
-rw-r--r--py/asmxtensa.c2
-rw-r--r--py/asmxtensa.h2
-rw-r--r--py/bc.c2
-rw-r--r--py/bc.h2
-rw-r--r--py/bc0.h2
-rw-r--r--py/binary.c2
-rw-r--r--py/binary.h2
-rw-r--r--py/builtin.h2
-rw-r--r--py/builtinevex.c2
-rw-r--r--py/builtinhelp.c2
-rw-r--r--py/builtinimport.c2
-rw-r--r--py/circuitpy_defns.mk18
-rw-r--r--py/circuitpy_mpconfig.h33
-rw-r--r--py/circuitpy_mpconfig.mk18
-rw-r--r--py/compile.c12
-rw-r--r--py/compile.h2
-rw-r--r--py/emit.h2
-rw-r--r--py/emitbc.c2
-rw-r--r--py/emitcommon.c2
-rw-r--r--py/emitglue.c4
-rw-r--r--py/emitglue.h2
-rw-r--r--py/emitinlinethumb.c2
-rw-r--r--py/emitinlinextensa.c2
-rw-r--r--py/emitnative.c2
-rw-r--r--py/formatfloat.c2
-rw-r--r--py/formatfloat.h2
-rw-r--r--py/frozenmod.c2
-rw-r--r--py/frozenmod.h2
-rwxr-xr-xpy/gc.c18
-rw-r--r--py/gc.h2
-rw-r--r--py/grammar.h2
-rw-r--r--py/ioctl.h2
-rw-r--r--py/lexer.c2
-rw-r--r--py/lexer.h2
-rw-r--r--py/malloc.c2
-rw-r--r--py/map.c2
-rw-r--r--py/misc.h2
-rw-r--r--py/modarray.c2
-rw-r--r--py/modbuiltins.c2
-rw-r--r--py/modcmath.c2
-rw-r--r--py/modcollections.c2
-rw-r--r--py/modgc.c2
-rw-r--r--py/modio.c2
-rw-r--r--py/modmath.c2
-rw-r--r--py/modmicropython.c2
-rw-r--r--py/modstruct.c2
-rw-r--r--py/modsys.c2
-rw-r--r--py/modthread.c2
-rw-r--r--py/moduerrno.c2
-rwxr-xr-xpy/mpconfig.h2
-rw-r--r--py/mperrno.h2
-rw-r--r--py/mphal.h2
-rw-r--r--py/mpprint.c2
-rw-r--r--py/mpprint.h2
-rw-r--r--py/mpstate.c2
-rw-r--r--py/mpstate.h2
-rw-r--r--py/mpthread.h2
-rw-r--r--py/mpz.c6
-rw-r--r--py/mpz.h2
-rw-r--r--py/nativeglue.c2
-rw-r--r--py/nlr.c2
-rw-r--r--py/nlr.h2
-rw-r--r--py/nlrsetjmp.c2
-rw-r--r--py/nlrthumb.c2
-rw-r--r--py/nlrx64.c2
-rw-r--r--py/nlrx86.c2
-rw-r--r--py/nlrxtensa.c2
-rw-r--r--py/obj.c2
-rw-r--r--py/obj.h4
-rw-r--r--py/objarray.c68
-rw-r--r--py/objarray.h2
-rw-r--r--py/objattrtuple.c2
-rw-r--r--py/objbool.c2
-rw-r--r--py/objboundmeth.c2
-rw-r--r--py/objcell.c2
-rw-r--r--py/objclosure.c2
-rw-r--r--py/objcomplex.c2
-rw-r--r--py/objdict.c2
-rw-r--r--py/objenumerate.c2
-rw-r--r--py/objexcept.c2
-rw-r--r--py/objexcept.h2
-rw-r--r--py/objfilter.c2
-rw-r--r--py/objfloat.c2
-rw-r--r--py/objfun.c2
-rw-r--r--py/objfun.h2
-rw-r--r--py/objgenerator.c21
-rw-r--r--py/objgenerator.h2
-rw-r--r--py/objgetitemiter.c2
-rw-r--r--py/objint.c2
-rw-r--r--py/objint.h2
-rw-r--r--py/objint_longlong.c2
-rw-r--r--py/objint_mpz.c2
-rw-r--r--py/objlist.c2
-rw-r--r--py/objlist.h2
-rw-r--r--py/objmap.c2
-rw-r--r--py/objmodule.c2
-rw-r--r--py/objmodule.h2
-rw-r--r--py/objnamedtuple.c2
-rw-r--r--py/objnamedtuple.h2
-rw-r--r--py/objnone.c2
-rw-r--r--py/objobject.c2
-rw-r--r--py/objproperty.c2
-rw-r--r--py/objproperty.h2
-rw-r--r--py/objrange.c2
-rw-r--r--py/objreversed.c2
-rw-r--r--py/objset.c2
-rw-r--r--py/objsingleton.c2
-rw-r--r--py/objslice.c2
-rw-r--r--py/objstr.c2
-rw-r--r--py/objstr.h6
-rw-r--r--py/objstringio.c2
-rw-r--r--py/objstringio.h2
-rw-r--r--py/objstrunicode.c2
-rw-r--r--py/objtuple.c2
-rw-r--r--py/objtuple.h2
-rw-r--r--py/objtype.c2
-rw-r--r--py/objtype.h2
-rw-r--r--py/objzip.c2
-rw-r--r--py/opmethods.c2
-rw-r--r--py/parse.c2
-rw-r--r--py/parse.h2
-rw-r--r--py/parsenum.c2
-rw-r--r--py/parsenum.h2
-rw-r--r--py/parsenumbase.c2
-rw-r--r--py/parsenumbase.h2
-rw-r--r--py/persistentcode.c2
-rw-r--r--py/persistentcode.h2
-rw-r--r--py/py.mk6
-rw-r--r--py/pystack.c2
-rw-r--r--py/pystack.h2
-rwxr-xr-xpy/qstr.c2
-rw-r--r--py/qstr.h2
-rw-r--r--py/qstrdefs.h2
-rw-r--r--py/reader.c2
-rw-r--r--py/reader.h2
-rw-r--r--py/repl.c2
-rw-r--r--py/repl.h2
-rw-r--r--py/runtime.c2
-rw-r--r--py/runtime.h2
-rw-r--r--py/runtime0.h3
-rw-r--r--py/scheduler.c2
-rw-r--r--py/scope.c2
-rw-r--r--py/scope.h2
-rw-r--r--py/sequence.c2
-rw-r--r--py/showbc.c2
-rw-r--r--py/smallint.c2
-rw-r--r--py/smallint.h2
-rw-r--r--py/stream.c2
-rw-r--r--py/stream.h2
-rw-r--r--py/unicode.c2
-rw-r--r--py/unicode.h2
-rw-r--r--py/vm.c2
-rw-r--r--py/vmentrytable.h2
-rw-r--r--py/vstr.c2
-rw-r--r--py/warning.c2
166 files changed, 347 insertions, 176 deletions
diff --git a/py/argcheck.c b/py/argcheck.c
index a8df206e2..9341c02a6 100644
--- a/py/argcheck.c
+++ b/py/argcheck.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmarm.c b/py/asmarm.c
index 1a8923bc2..11e498b2c 100644
--- a/py/asmarm.c
+++ b/py/asmarm.c
@@ -4,7 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2014 Fabian Vogt
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmarm.h b/py/asmarm.h
index 560303091..f63106a9b 100644
--- a/py/asmarm.h
+++ b/py/asmarm.h
@@ -4,7 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2014 Fabian Vogt
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmbase.c b/py/asmbase.c
index 4c84c3b25..4d080f095 100644
--- a/py/asmbase.c
+++ b/py/asmbase.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmbase.h b/py/asmbase.h
index d2b403893..3b2f59d15 100644
--- a/py/asmbase.h
+++ b/py/asmbase.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmthumb.c b/py/asmthumb.c
index c5b45f2f5..3cf47c5b1 100644
--- a/py/asmthumb.c
+++ b/py/asmthumb.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmthumb.h b/py/asmthumb.h
index b7e2acc04..32219eb55 100644
--- a/py/asmthumb.h
+++ b/py/asmthumb.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmx64.c b/py/asmx64.c
index c900a08d1..8706b806e 100644
--- a/py/asmx64.c
+++ b/py/asmx64.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmx64.h b/py/asmx64.h
index ed0b785fb..113d92511 100644
--- a/py/asmx64.h
+++ b/py/asmx64.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmx86.c b/py/asmx86.c
index 3938baaac..8a08c68a0 100644
--- a/py/asmx86.c
+++ b/py/asmx86.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmx86.h b/py/asmx86.h
index 0908b8c71..05902350f 100644
--- a/py/asmx86.h
+++ b/py/asmx86.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmxtensa.c b/py/asmxtensa.c
index 00448dfc5..98b49ecb5 100644
--- a/py/asmxtensa.c
+++ b/py/asmxtensa.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/asmxtensa.h b/py/asmxtensa.h
index ef80f700a..d43824338 100644
--- a/py/asmxtensa.h
+++ b/py/asmxtensa.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/bc.c b/py/bc.c
index 69b4cb238..640671338 100644
--- a/py/bc.c
+++ b/py/bc.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/bc.h b/py/bc.h
index ebfdeaac1..b71325f92 100644
--- a/py/bc.h
+++ b/py/bc.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/bc0.h b/py/bc0.h
index 70acfb0ca..a031bcc88 100644
--- a/py/bc0.h
+++ b/py/bc0.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/binary.c b/py/binary.c
index 2ec12fa93..cd0f1aa4d 100644
--- a/py/binary.c
+++ b/py/binary.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/binary.h b/py/binary.h
index 0dae6a29e..6c70d9333 100644
--- a/py/binary.h
+++ b/py/binary.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/builtin.h b/py/builtin.h
index 6e0d5d9be..2275691fc 100644
--- a/py/builtin.h
+++ b/py/builtin.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/builtinevex.c b/py/builtinevex.c
index cb046b407..ade12d39d 100644
--- a/py/builtinevex.c
+++ b/py/builtinevex.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/builtinhelp.c b/py/builtinhelp.c
index 01c0bc84e..d12e088d6 100644
--- a/py/builtinhelp.c
+++ b/py/builtinhelp.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/builtinimport.c b/py/builtinimport.c
index 2be779c6c..597819f55 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index e2850e63f..bc03b9f3b 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
-# Copyright (c) 2019 Dan Halbert for Adafruit Industries
+# SPDX-FileCopyrightText: Copyright (c) 2019 Dan Halbert for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -174,6 +174,9 @@ endif
ifeq ($(CIRCUITPY__EVE),1)
SRC_PATTERNS += _eve/%
endif
+ifeq ($(CIRCUITPY_MEMORYMONITOR),1)
+SRC_PATTERNS += memorymonitor/%
+endif
ifeq ($(CIRCUITPY_MICROCONTROLLER),1)
SRC_PATTERNS += microcontroller/%
endif
@@ -213,6 +216,12 @@ endif
ifeq ($(CIRCUITPY_SAMD),1)
SRC_PATTERNS += samd/%
endif
+ifeq ($(CIRCUITPY_SDCARDIO),1)
+SRC_PATTERNS += sdcardio/%
+endif
+ifeq ($(CIRCUITPY_SDIOIO),1)
+SRC_PATTERNS += sdioio/%
+endif
ifeq ($(CIRCUITPY_STAGE),1)
SRC_PATTERNS += _stage/%
endif
@@ -311,6 +320,8 @@ SRC_COMMON_HAL_ALL = \
rotaryio/__init__.c \
rtc/RTC.c \
rtc/__init__.c \
+ sdioio/SDCard.c \
+ sdioio/__init__.c \
supervisor/Runtime.c \
supervisor/__init__.c \
watchdog/WatchDogMode.c \
@@ -393,10 +404,15 @@ SRC_SHARED_MODULE_ALL = \
fontio/__init__.c \
framebufferio/FramebufferDisplay.c \
framebufferio/__init__.c \
+ sdcardio/SDCard.c \
+ sdcardio/__init__.c \
gamepad/GamePad.c \
gamepad/__init__.c \
gamepadshift/GamePadShift.c \
gamepadshift/__init__.c \
+ memorymonitor/__init__.c \
+ memorymonitor/AllocationAlarm.c \
+ memorymonitor/AllocationSize.c \
network/__init__.c \
os/__init__.c \
random/__init__.c \
diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index c92cb1b66..255ab99b9 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
@@ -429,6 +430,16 @@ extern const struct _mp_obj_module_t _eve_module;
#define _EVE_MODULE
#endif
+#if CIRCUITPY_MEMORYMONITOR
+extern const struct _mp_obj_module_t memorymonitor_module;
+#define MEMORYMONITOR_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_memorymonitor), (mp_obj_t)&memorymonitor_module },
+#define MEMORYMONITOR_ROOT_POINTERS mp_obj_t active_allocationsizes; \
+ mp_obj_t active_allocationalarms;
+#else
+#define MEMORYMONITOR_MODULE
+#define MEMORYMONITOR_ROOT_POINTERS
+#endif
+
#if CIRCUITPY_MICROCONTROLLER
extern const struct _mp_obj_module_t microcontroller_module;
#define MICROCONTROLLER_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)&microcontroller_module },
@@ -537,6 +548,20 @@ extern const struct _mp_obj_module_t samd_module;
#define SAMD_MODULE
#endif
+#if CIRCUITPY_SDCARDIO
+extern const struct _mp_obj_module_t sdcardio_module;
+#define SDCARDIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_sdcardio), (mp_obj_t)&sdcardio_module },
+#else
+#define SDCARDIO_MODULE
+#endif
+
+#if CIRCUITPY_SDIOIO
+extern const struct _mp_obj_module_t sdioio_module;
+#define SDIOIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_sdioio), (mp_obj_t)&sdioio_module },
+#else
+#define SDIOIO_MODULE
+#endif
+
#if CIRCUITPY_STAGE
extern const struct _mp_obj_module_t stage_module;
#define STAGE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__stage), (mp_obj_t)&stage_module },
@@ -694,6 +719,7 @@ extern const struct _mp_obj_module_t watchdog_module;
JSON_MODULE \
MATH_MODULE \
_EVE_MODULE \
+ MEMORYMONITOR_MODULE \
MICROCONTROLLER_MODULE \
NEOPIXEL_WRITE_MODULE \
NETWORK_MODULE \
@@ -709,6 +735,8 @@ extern const struct _mp_obj_module_t watchdog_module;
ROTARYIO_MODULE \
RTC_MODULE \
SAMD_MODULE \
+ SDCARDIO_MODULE \
+ SDIOIO_MODULE \
STAGE_MODULE \
STORAGE_MODULE \
STRUCT_MODULE \
@@ -749,6 +777,7 @@ extern const struct _mp_obj_module_t watchdog_module;
mp_obj_t terminal_tilegrid_tiles; \
BOARD_UART_ROOT_POINTER \
FLASH_ROOT_POINTERS \
+ MEMORYMONITOR_ROOT_POINTERS \
NETWORK_ROOT_POINTERS \
void supervisor_run_background_tasks_if_tick(void);
@@ -769,6 +798,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 1536
+#endif
+
#define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt"
#define CIRCUITPY_VERBOSE_BLE 0
diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk
index 239bb665e..12a9a6879 100644
--- a/py/circuitpy_mpconfig.mk
+++ b/py/circuitpy_mpconfig.mk
@@ -3,7 +3,7 @@
#
# The MIT License (MIT)
#
-# Copyright (c) 2019 Dan Halbert for Adafruit Industries
+# SPDX-FileCopyrightText: Copyright (c) 2019 Dan Halbert for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -42,12 +42,13 @@ CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO)
CIRCUITPY_AUDIOBUSIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_AUDIOBUSIO=$(CIRCUITPY_AUDIOBUSIO)
+# Some boards have PDMIn but do not implement I2SOut.
+CIRCUITPY_AUDIOBUSIO_I2SOUT ?= $(CIRCUITPY_AUDIOBUSIO)
+CFLAGS += -DCIRCUITPY_AUDIOBUSIO_I2SOUT=$(CIRCUITPY_AUDIOBUSIO_I2SOUT)
+
CIRCUITPY_AUDIOIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO)
-CIRCUITPY_AUDIOIO_COMPAT ?= $(CIRCUITPY_AUDIOIO)
-CFLAGS += -DCIRCUITPY_AUDIOIO_COMPAT=$(CIRCUITPY_AUDIOIO_COMPAT)
-
CIRCUITPY_AUDIOPWMIO ?= 0
CFLAGS += -DCIRCUITPY_AUDIOPWMIO=$(CIRCUITPY_AUDIOPWMIO)
@@ -125,6 +126,9 @@ CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH)
CIRCUITPY__EVE ?= 0
CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE)
+CIRCUITPY_MEMORYMONITOR ?= 0
+CFLAGS += -DCIRCUITPY_MEMORYMONITOR=$(CIRCUITPY_MEMORYMONITOR)
+
CIRCUITPY_MICROCONTROLLER ?= 1
CFLAGS += -DCIRCUITPY_MICROCONTROLLER=$(CIRCUITPY_MICROCONTROLLER)
@@ -170,6 +174,12 @@ CFLAGS += -DCIRCUITPY_RTC=$(CIRCUITPY_RTC)
CIRCUITPY_SAMD ?= 0
CFLAGS += -DCIRCUITPY_SAMD=$(CIRCUITPY_SAMD)
+CIRCUITPY_SDCARDIO ?= $(CIRCUITPY_FULL_BUILD)
+CFLAGS += -DCIRCUITPY_SDCARDIO=$(CIRCUITPY_SDCARDIO)
+
+CIRCUITPY_SDIOIO ?= 0
+CFLAGS += -DCIRCUITPY_SDIOIO=$(CIRCUITPY_SDIOIO)
+
# Currently always off.
CIRCUITPY_STAGE ?= 0
CFLAGS += -DCIRCUITPY_STAGE=$(CIRCUITPY_STAGE)
diff --git a/py/compile.c b/py/compile.c
index d5fae0299..653aae004 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2015 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1713,11 +1713,11 @@ STATIC void compile_yield_from(compiler_t *comp) {
#if MICROPY_PY_ASYNC_AWAIT
STATIC bool compile_require_async_context(compiler_t *comp, mp_parse_node_struct_t *pns) {
int scope_flags = comp->scope_cur->scope_flags;
- if(scope_flags & MP_SCOPE_FLAG_GENERATOR) {
+ if(scope_flags & MP_SCOPE_FLAG_ASYNC) {
return true;
}
compile_syntax_error(comp, (mp_parse_node_t)pns,
- translate("'async for' or 'async with' outside async function"));
+ translate("'await', 'async for' or 'async with' outside async function"));
return false;
}
@@ -1741,7 +1741,8 @@ STATIC void compile_async_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns
uint try_finally_label = comp_next_label(comp);
compile_node(comp, pns->nodes[1]); // iterator
- compile_await_object_method(comp, MP_QSTR___aiter__);
+ EMIT_ARG(load_method, MP_QSTR___aiter__, false);
+ EMIT_ARG(call_method, 0, 0, 0);
compile_store_id(comp, context);
START_BREAK_CONTINUE_BLOCK
@@ -1890,7 +1891,7 @@ STATIC void compile_async_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
// async def
compile_funcdef(comp, pns0);
scope_t *fscope = (scope_t*)pns0->nodes[4];
- fscope->scope_flags |= MP_SCOPE_FLAG_GENERATOR;
+ fscope->scope_flags |= MP_SCOPE_FLAG_GENERATOR | MP_SCOPE_FLAG_ASYNC;
} else if (MP_PARSE_NODE_STRUCT_KIND(pns0) == PN_for_stmt) {
// async for
compile_async_for_stmt(comp, pns0);
@@ -2645,6 +2646,7 @@ STATIC void compile_atom_expr_await(compiler_t *comp, mp_parse_node_struct_t *pn
compile_syntax_error(comp, (mp_parse_node_t)pns, translate("'await' outside function"));
return;
}
+ compile_require_async_context(comp, pns);
compile_atom_expr_normal(comp, pns);
compile_yield_from(comp);
}
diff --git a/py/compile.h b/py/compile.h
index 3297e83ae..0f8d023a2 100644
--- a/py/compile.h
+++ b/py/compile.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/emit.h b/py/emit.h
index aa98efa77..30543d2a3 100644
--- a/py/emit.h
+++ b/py/emit.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/emitbc.c b/py/emitbc.c
index f3951e9cb..f45dcb916 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/emitcommon.c b/py/emitcommon.c
index 89cc2c959..88c9803a6 100644
--- a/py/emitcommon.c
+++ b/py/emitcommon.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/emitglue.c b/py/emitglue.c
index 7708689dd..7635a73d6 100644
--- a/py/emitglue.c
+++ b/py/emitglue.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -152,7 +152,7 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_ar
// check for generator functions and if so wrap in generator object
if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) {
- fun = mp_obj_new_gen_wrap(fun);
+ fun = mp_obj_new_gen_wrap(fun, (rc->scope_flags & MP_SCOPE_FLAG_ASYNC) != 0);
}
return fun;
diff --git a/py/emitglue.h b/py/emitglue.h
index 0830a0d5c..2ddcc3e53 100644
--- a/py/emitglue.h
+++ b/py/emitglue.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/emitinlinethumb.c b/py/emitinlinethumb.c
index 7f0ec6659..47ed14321 100644
--- a/py/emitinlinethumb.c
+++ b/py/emitinlinethumb.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/emitinlinextensa.c b/py/emitinlinextensa.c
index 9cd65824b..ae84aae2e 100644
--- a/py/emitinlinextensa.c
+++ b/py/emitinlinextensa.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/emitnative.c b/py/emitnative.c
index 60f31d15f..51919e389 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/formatfloat.c b/py/formatfloat.c
index dc7fc1d1f..166a98a2e 100644
--- a/py/formatfloat.c
+++ b/py/formatfloat.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/formatfloat.h b/py/formatfloat.h
index 9a1643b4d..c433cb805 100644
--- a/py/formatfloat.h
+++ b/py/formatfloat.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/frozenmod.c b/py/frozenmod.c
index a9143b582..0e040a44f 100644
--- a/py/frozenmod.c
+++ b/py/frozenmod.c
@@ -4,7 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2015 Paul Sokolovsky
- * Copyright (c) 2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/frozenmod.h b/py/frozenmod.h
index 1e50f3807..3ba1b590d 100644
--- a/py/frozenmod.h
+++ b/py/frozenmod.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/gc.c b/py/gc.c
index 271bc9462..69327060f 100755
--- a/py/gc.c
+++ b/py/gc.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -33,6 +33,10 @@
#include "supervisor/shared/safe_mode.h"
+#if CIRCUITPY_MEMORYMONITOR
+#include "shared-module/memorymonitor/__init__.h"
+#endif
+
#if MICROPY_ENABLE_GC
#if MICROPY_DEBUG_VERBOSE // print debugging info
@@ -653,6 +657,10 @@ void *gc_alloc(size_t n_bytes, bool has_finaliser, bool long_lived) {
gc_dump_alloc_table();
#endif
+ #if CIRCUITPY_MEMORYMONITOR
+ memorymonitor_track_allocation(end_block - start_block + 1);
+ #endif
+
return ret_ptr;
}
@@ -906,6 +914,10 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
gc_log_change(block, new_blocks);
#endif
+ #if CIRCUITPY_MEMORYMONITOR
+ memorymonitor_track_allocation(new_blocks);
+ #endif
+
return ptr_in;
}
@@ -935,6 +947,10 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) {
gc_log_change(block, new_blocks);
#endif
+ #if CIRCUITPY_MEMORYMONITOR
+ memorymonitor_track_allocation(new_blocks);
+ #endif
+
return ptr_in;
}
diff --git a/py/gc.h b/py/gc.h
index 2a0811f4e..b7c2889d5 100644
--- a/py/gc.h
+++ b/py/gc.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/grammar.h b/py/grammar.h
index 5a5b682ac..28f785039 100644
--- a/py/grammar.h
+++ b/py/grammar.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2015 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/ioctl.h b/py/ioctl.h
index ced427590..8c84835cc 100644
--- a/py/ioctl.h
+++ b/py/ioctl.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2015 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/lexer.c b/py/lexer.c
index 00cd59bca..de121f87a 100644
--- a/py/lexer.c
+++ b/py/lexer.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/lexer.h b/py/lexer.h
index a3eaa2a7e..74195fe03 100644
--- a/py/lexer.h
+++ b/py/lexer.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/malloc.c b/py/malloc.c
index f190582ab..8d5141ee0 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/map.c b/py/map.c
index 57c11dbc9..69eed9d3b 100644
--- a/py/map.c
+++ b/py/map.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/misc.h b/py/misc.h
index abcc7edf7..6ed256e70 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/modarray.c b/py/modarray.c
index c0cdca928..75bc5169f 100644
--- a/py/modarray.c
+++ b/py/modarray.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index e764f1987..905c3471f 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/modcmath.c b/py/modcmath.c
index 70fd542af..d6b364733 100644
--- a/py/modcmath.c
+++ b/py/modcmath.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/modcollections.c b/py/modcollections.c
index 91e735528..9634c5ce7 100644
--- a/py/modcollections.c
+++ b/py/modcollections.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/modgc.c b/py/modgc.c
index 55e73defc..b01876422 100644
--- a/py/modgc.c
+++ b/py/modgc.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/modio.c b/py/modio.c
index 17840a6d8..4bcc3971e 100644
--- a/py/modio.c
+++ b/py/modio.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/modmath.c b/py/modmath.c
index 9d75ea2d5..ec520bb6f 100644
--- a/py/modmath.c
+++ b/py/modmath.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/modmicropython.c b/py/modmicropython.c
index a45d44653..7e29825ae 100644
--- a/py/modmicropython.c
+++ b/py/modmicropython.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/modstruct.c b/py/modstruct.c
index a238d3935..fe766a4de 100644
--- a/py/modstruct.c
+++ b/py/modstruct.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/modsys.c b/py/modsys.c
index 68e048d91..a1d2cf831 100644
--- a/py/modsys.c
+++ b/py/modsys.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014-2017 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/modthread.c b/py/modthread.c
index 1c00f6397..250756ef2 100644
--- a/py/modthread.c
+++ b/py/modthread.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+ * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/moduerrno.c b/py/moduerrno.c
index 3be5adba1..3928f8cd8 100644
--- a/py/moduerrno.c
+++ b/py/moduerrno.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 513f04f6e..034d39d40 100755
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/mperrno.h b/py/mperrno.h
index 911a9b413..e339fde85 100644
--- a/py/mperrno.h
+++ b/py/mperrno.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/mphal.h b/py/mphal.h
index 92de01d08..c242dd245 100644
--- a/py/mphal.h
+++ b/py/mphal.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2015 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/mpprint.c b/py/mpprint.c
index c2e65301c..e814d2ebe 100644
--- a/py/mpprint.c
+++ b/py/mpprint.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2015 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/mpprint.h b/py/mpprint.h
index 07462bddc..0d12b9a3d 100644
--- a/py/mpprint.h
+++ b/py/mpprint.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/mpstate.c b/py/mpstate.c
index 32f1d60a5..b3957cc09 100644
--- a/py/mpstate.c
+++ b/py/mpstate.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/mpstate.h b/py/mpstate.h
index a5815776a..32f353528 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/mpthread.h b/py/mpthread.h
index 602df830c..3a6983e9d 100644
--- a/py/mpthread.h
+++ b/py/mpthread.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+ * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/mpz.c b/py/mpz.c
index 8687092d0..41b46f92f 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -444,6 +444,10 @@ STATIC size_t mpn_mul(mpz_dig_t *idig, mpz_dig_t *jdig, size_t jlen, mpz_dig_t *
}
ilen = id - oidig;
+ // check to prevent usb starvation
+ #ifdef RUN_BACKGROUND_TASKS
+ RUN_BACKGROUND_TASKS;
+ #endif
}
return ilen;
diff --git a/py/mpz.h b/py/mpz.h
index 3c36cac66..e412f5cce 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/nativeglue.c b/py/nativeglue.c
index b87da6931..9ac806009 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/nlr.c b/py/nlr.c
index 1bfd9c19b..95d833177 100644
--- a/py/nlr.c
+++ b/py/nlr.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/nlr.h b/py/nlr.h
index 1b95002d3..aed24e277 100644
--- a/py/nlr.h
+++ b/py/nlr.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/nlrsetjmp.c b/py/nlrsetjmp.c
index 960dd86f5..a93595dc8 100644
--- a/py/nlrsetjmp.c
+++ b/py/nlrsetjmp.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/nlrthumb.c b/py/nlrthumb.c
index 056aa358e..464995fa8 100644
--- a/py/nlrthumb.c
+++ b/py/nlrthumb.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/nlrx64.c b/py/nlrx64.c
index 569ad84fb..246d6a95b 100644
--- a/py/nlrx64.c
+++ b/py/nlrx64.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/nlrx86.c b/py/nlrx86.c
index 6fbbe4432..18306253d 100644
--- a/py/nlrx86.c
+++ b/py/nlrx86.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/nlrxtensa.c b/py/nlrxtensa.c
index 564035004..e04535ff8 100644
--- a/py/nlrxtensa.c
+++ b/py/nlrxtensa.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014-2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014-2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/obj.c b/py/obj.c
index 4fa2032dc..7644b5de8 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/obj.h b/py/obj.h
index fa315d12f..e603d4a49 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -665,7 +665,7 @@ mp_obj_t mp_obj_new_fun_bc(mp_obj_t def_args, mp_obj_t def_kw_args, const byte *
mp_obj_t mp_obj_new_fun_native(mp_obj_t def_args_in, mp_obj_t def_kw_args, const void *fun_data, const mp_uint_t *const_table);
mp_obj_t mp_obj_new_fun_viper(size_t n_args, void *fun_data, mp_uint_t type_sig);
mp_obj_t mp_obj_new_fun_asm(size_t n_args, void *fun_data, mp_uint_t type_sig);
-mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun);
+mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun, bool is_coroutine);
mp_obj_t mp_obj_new_closure(mp_obj_t fun, size_t n_closed, const mp_obj_t *closed);
mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items);
mp_obj_t mp_obj_new_list(size_t n, mp_obj_t *items);
diff --git a/py/objarray.c b/py/objarray.c
index fccb966a2..5d83f0697 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -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/py/objarray.h b/py/objarray.h
index 0dad70571..7ad5328f0 100644
--- a/py/objarray.h
+++ b/py/objarray.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/objattrtuple.c b/py/objattrtuple.c
index 3cc298d4e..ac9b808a2 100644
--- a/py/objattrtuple.c
+++ b/py/objattrtuple.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2015 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objbool.c b/py/objbool.c
index cd7d7100c..5e8f630ff 100644
--- a/py/objbool.c
+++ b/py/objbool.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index a05680d41..5bf25567f 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objcell.c b/py/objcell.c
index 111906412..25fe5232a 100644
--- a/py/objcell.c
+++ b/py/objcell.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objclosure.c b/py/objclosure.c
index 4eb9eb8b8..6f6772ff1 100644
--- a/py/objclosure.c
+++ b/py/objclosure.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objcomplex.c b/py/objcomplex.c
index b38e2c5fa..43e0690d3 100644
--- a/py/objcomplex.c
+++ b/py/objcomplex.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objdict.c b/py/objdict.c
index 3ec3cbe80..39169fe1a 100644
--- a/py/objdict.c
+++ b/py/objdict.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objenumerate.c b/py/objenumerate.c
index 818725d85..dee7fc760 100644
--- a/py/objenumerate.c
+++ b/py/objenumerate.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objexcept.c b/py/objexcept.c
index 796be122f..e3b953543 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objexcept.h b/py/objexcept.h
index 7c3076224..c19658427 100644
--- a/py/objexcept.h
+++ b/py/objexcept.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objfilter.c b/py/objfilter.c
index af95326e6..0e02f4b5e 100644
--- a/py/objfilter.c
+++ b/py/objfilter.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objfloat.c b/py/objfloat.c
index f544ade05..59f1eb2f6 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objfun.c b/py/objfun.c
index c586a290a..933044ef7 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/objfun.h b/py/objfun.h
index fbb351626..457c3cf48 100644
--- a/py/objfun.h
+++ b/py/objfun.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objgenerator.c b/py/objgenerator.c
index 01d42ba94..df421b60c 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014-2017 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -42,11 +42,13 @@
typedef struct _mp_obj_gen_wrap_t {
mp_obj_base_t base;
mp_obj_t *fun;
+ bool coroutine_generator;
} mp_obj_gen_wrap_t;
typedef struct _mp_obj_gen_instance_t {
mp_obj_base_t base;
mp_obj_dict_t *globals;
+ bool coroutine_generator;
mp_code_state_t code_state;
} mp_obj_gen_instance_t;
@@ -64,6 +66,7 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, cons
n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t));
o->base.type = &mp_type_gen_instance;
+ o->coroutine_generator = self->coroutine_generator;
o->globals = self_fun->globals;
o->code_state.fun_bc = self_fun;
o->code_state.ip = 0;
@@ -78,10 +81,11 @@ const mp_obj_type_t mp_type_gen_wrap = {
.unary_op = mp_generic_unary_op,
};
-mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun) {
+mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun, bool is_coroutine) {
mp_obj_gen_wrap_t *o = m_new_obj(mp_obj_gen_wrap_t);
o->base.type = &mp_type_gen_wrap;
o->fun = MP_OBJ_TO_PTR(fun);
+ o->coroutine_generator = is_coroutine;
return MP_OBJ_FROM_PTR(o);
}
@@ -91,6 +95,12 @@ mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun) {
STATIC void gen_instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in);
+#if MICROPY_PY_ASYNC_AWAIT
+ if (self->coroutine_generator) {
+ mp_printf(print, "<coroutine object '%q' at %p>", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self);
+ return;
+ }
+#endif
mp_printf(print, "<generator object '%q' at %p>", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self);
}
@@ -194,6 +204,13 @@ STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_o
}
STATIC mp_obj_t gen_instance_iternext(mp_obj_t self_in) {
+#if MICROPY_PY_ASYNC_AWAIT
+ // This translate is literally too much for m0 boards
+ mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in);
+ if (self->coroutine_generator) {
+ mp_raise_TypeError(translate("'coroutine' object is not an iterator"));
+ }
+#endif
return gen_resume_and_raise(self_in, mp_const_none, MP_OBJ_NULL);
}
diff --git a/py/objgenerator.h b/py/objgenerator.h
index 80bf9cd86..4b7f8c1ac 100644
--- a/py/objgenerator.h
+++ b/py/objgenerator.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objgetitemiter.c b/py/objgetitemiter.c
index ec41c2c5b..44e8fe889 100644
--- a/py/objgetitemiter.c
+++ b/py/objgetitemiter.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objint.c b/py/objint.c
index b78c9f25b..82f5aadd1 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objint.h b/py/objint.h
index e8c9bc3e0..bba9ff50a 100644
--- a/py/objint.h
+++ b/py/objint.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objint_longlong.c b/py/objint_longlong.c
index ce02fa175..189049630 100644
--- a/py/objint_longlong.c
+++ b/py/objint_longlong.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index 95e4d7e17..90060114e 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objlist.c b/py/objlist.c
index 608ea9f6c..9242020d4 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objlist.h b/py/objlist.h
index a43663db7..f02030557 100644
--- a/py/objlist.h
+++ b/py/objlist.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objmap.c b/py/objmap.c
index cf71f99ee..5cf975f49 100644
--- a/py/objmap.c
+++ b/py/objmap.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objmodule.c b/py/objmodule.c
index b6a8a084e..757aece04 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objmodule.h b/py/objmodule.h
index b7702ec50..0b9b2d130 100644
--- a/py/objmodule.h
+++ b/py/objmodule.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c
index 84dcf7909..6c36909e7 100644
--- a/py/objnamedtuple.c
+++ b/py/objnamedtuple.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/objnamedtuple.h b/py/objnamedtuple.h
index 0ea0d2862..9f290c3ec 100644
--- a/py/objnamedtuple.h
+++ b/py/objnamedtuple.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/objnone.c b/py/objnone.c
index da1031835..b1fbd48f7 100644
--- a/py/objnone.c
+++ b/py/objnone.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objobject.c b/py/objobject.c
index a42edde3c..8983cd9ad 100644
--- a/py/objobject.c
+++ b/py/objobject.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objproperty.c b/py/objproperty.c
index ddf484af2..e909533c4 100644
--- a/py/objproperty.c
+++ b/py/objproperty.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objproperty.h b/py/objproperty.h
index f95c1083c..f3ade89d9 100644
--- a/py/objproperty.h
+++ b/py/objproperty.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objrange.c b/py/objrange.c
index 30d55c56c..7af9f37a1 100644
--- a/py/objrange.c
+++ b/py/objrange.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objreversed.c b/py/objreversed.c
index 4937d0818..63d122b5d 100644
--- a/py/objreversed.c
+++ b/py/objreversed.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objset.c b/py/objset.c
index 5d1608c7e..d986c6dda 100644
--- a/py/objset.c
+++ b/py/objset.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objsingleton.c b/py/objsingleton.c
index 67535391e..1c2757334 100644
--- a/py/objsingleton.c
+++ b/py/objsingleton.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objslice.c b/py/objslice.c
index cbbee326e..40d4d3c76 100644
--- a/py/objslice.c
+++ b/py/objslice.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objstr.c b/py/objstr.c
index a60f507e9..5e0c6fdfa 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/objstr.h b/py/objstr.h
index 61a11d0bd..cddc6a83a 100644
--- a/py/objstr.h
+++ b/py/objstr.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -77,8 +77,8 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
mp_obj_t index, bool is_slice);
const byte *find_subbytes(const byte *haystack, size_t hlen, const byte *needle, size_t nlen, int direction);
-const char nibble_to_hex_upper[16];
-const char nibble_to_hex_lower[16];
+extern const char nibble_to_hex_upper[16];
+extern const char nibble_to_hex_lower[16];
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_encode_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj);
diff --git a/py/objstringio.c b/py/objstringio.c
index 178e6446c..eb40e5154 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/objstringio.h b/py/objstringio.h
index 56738f4e4..38778f03a 100644
--- a/py/objstringio.h
+++ b/py/objstringio.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objstrunicode.c b/py/objstrunicode.c
index 30000a51e..351a67e91 100644
--- a/py/objstrunicode.c
+++ b/py/objstrunicode.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/objtuple.c b/py/objtuple.c
index 0a2ed6f4c..d34a7f762 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objtuple.h b/py/objtuple.h
index 7f20ab7b6..d2e87e994 100644
--- a/py/objtuple.h
+++ b/py/objtuple.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objtype.c b/py/objtype.c
index ad68b85d2..fd51ce36b 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2018 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2018 Damien P. George
* Copyright (c) 2014-2016 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/objtype.h b/py/objtype.h
index a32c87496..a44622ffe 100644
--- a/py/objtype.h
+++ b/py/objtype.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/objzip.c b/py/objzip.c
index ce9afd55d..885e46441 100644
--- a/py/objzip.c
+++ b/py/objzip.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/opmethods.c b/py/opmethods.c
index 247fa5bbc..07d1e340d 100644
--- a/py/opmethods.c
+++ b/py/opmethods.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/parse.c b/py/parse.c
index b8cfda2cb..28621cf89 100644
--- a/py/parse.c
+++ b/py/parse.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/parse.h b/py/parse.h
index 9a1a2b4dd..946b41eac 100644
--- a/py/parse.h
+++ b/py/parse.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/parsenum.c b/py/parsenum.c
index 6ef309b47..da63825e4 100644
--- a/py/parsenum.c
+++ b/py/parsenum.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/parsenum.h b/py/parsenum.h
index a5bed731d..a91ca532d 100644
--- a/py/parsenum.h
+++ b/py/parsenum.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/parsenumbase.c b/py/parsenumbase.c
index ba1059122..e4ac6d00e 100644
--- a/py/parsenumbase.c
+++ b/py/parsenumbase.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/parsenumbase.h b/py/parsenumbase.h
index 3a525f993..43dcc2353 100644
--- a/py/parsenumbase.h
+++ b/py/parsenumbase.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/persistentcode.c b/py/persistentcode.c
index eb69bd407..9b438453a 100644
--- a/py/persistentcode.c
+++ b/py/persistentcode.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/persistentcode.h b/py/persistentcode.h
index d04e0b633..cbb300e4b 100644
--- a/py/persistentcode.h
+++ b/py/persistentcode.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/py.mk b/py/py.mk
index 62050519b..49fb0acaf 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -107,6 +107,7 @@ endif
ifeq ($(CIRCUITPY_ULAB),1)
SRC_MOD += $(patsubst $(TOP)/%,%,$(wildcard $(TOP)/extmod/ulab/code/*.c))
+SRC_MOD += $(patsubst $(TOP)/%,%,$(wildcard $(TOP)/extmod/ulab/code/*/*.c))
CFLAGS_MOD += -DCIRCUITPY_ULAB=1 -DMODULE_ULAB_ENABLED=1
$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-float-equal -Wno-sign-compare -DCIRCUITPY
endif
@@ -346,6 +347,11 @@ $(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/
$(PY_BUILD)/qstr.o: $(HEADER_BUILD)/qstrdefs.generated.h
+# Standard C functions like memset need to be compiled with special flags so
+# the compiler does not optimise these functions in terms of themselves.
+CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto
+$(BUILD)/lib/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN)
+
# Force nlr code to always be compiled with space-saving optimisation so
# that the function preludes are of a minimal and predictable form.
$(PY_BUILD)/nlr%.o: CFLAGS += -Os
diff --git a/py/pystack.c b/py/pystack.c
index 552e59d53..f79ea9210 100644
--- a/py/pystack.c
+++ b/py/pystack.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/pystack.h b/py/pystack.h
index 82ac3743d..3fbcdeeb8 100644
--- a/py/pystack.h
+++ b/py/pystack.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/qstr.c b/py/qstr.c
index bb8024435..17d8517c9 100755
--- a/py/qstr.c
+++ b/py/qstr.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/qstr.h b/py/qstr.h
index 39b904fb1..070a3cd4f 100644
--- a/py/qstr.h
+++ b/py/qstr.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/qstrdefs.h b/py/qstrdefs.h
index a60905812..b68267197 100644
--- a/py/qstrdefs.h
+++ b/py/qstrdefs.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/reader.c b/py/reader.c
index 80364104b..1b0bbf094 100644
--- a/py/reader.c
+++ b/py/reader.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/reader.h b/py/reader.h
index 8511c72ce..6d8565d7b 100644
--- a/py/reader.h
+++ b/py/reader.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2016 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2016 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/repl.c b/py/repl.c
index aa91c3f12..785c0fb53 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013-2015 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013-2015 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/repl.h b/py/repl.h
index a7a4136ca..89b64c45f 100644
--- a/py/repl.h
+++ b/py/repl.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/runtime.c b/py/runtime.c
index 59dcbc7a1..91ead1fba 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/runtime.h b/py/runtime.h
index f81103557..d3a82333e 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/runtime0.h b/py/runtime0.h
index 16434b315..fb35c8a9f 100644
--- a/py/runtime0.h
+++ b/py/runtime0.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -33,6 +33,7 @@
#define MP_SCOPE_FLAG_VARKEYWORDS (0x02)
#define MP_SCOPE_FLAG_GENERATOR (0x04)
#define MP_SCOPE_FLAG_DEFKWARGS (0x08)
+#define MP_SCOPE_FLAG_ASYNC (0x10)
// types for native (viper) function signature
#define MP_NATIVE_TYPE_OBJ (0x00)
diff --git a/py/scheduler.c b/py/scheduler.c
index 30851a4d2..fea7e0153 100644
--- a/py/scheduler.c
+++ b/py/scheduler.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2017 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/scope.c b/py/scope.c
index 1a6ae7b8a..98f39d4c6 100644
--- a/py/scope.c
+++ b/py/scope.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/scope.h b/py/scope.h
index e3b6a57c7..c92a39e5e 100644
--- a/py/scope.h
+++ b/py/scope.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/sequence.c b/py/sequence.c
index 0e668ea2a..e6421fde5 100644
--- a/py/sequence.c
+++ b/py/sequence.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/showbc.c b/py/showbc.c
index e71d8a253..5a8e660fc 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/smallint.c b/py/smallint.c
index aa542ca7b..9124b76c1 100644
--- a/py/smallint.c
+++ b/py/smallint.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/smallint.h b/py/smallint.h
index 6a3c75236..c58584413 100644
--- a/py/smallint.h
+++ b/py/smallint.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/stream.c b/py/stream.c
index 2ff2b76a6..ae702bb1b 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/stream.h b/py/stream.h
index dc9fc84c9..be6b23d40 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/unicode.c b/py/unicode.c
index 935dc9012..a17dbf969 100644
--- a/py/unicode.c
+++ b/py/unicode.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/unicode.h b/py/unicode.h
index c1fb51789..78e7a7ab7 100644
--- a/py/unicode.h
+++ b/py/unicode.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/vm.c b/py/vm.c
index 4f0340681..9b3354b09 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2014 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/py/vmentrytable.h b/py/vmentrytable.h
index 31a96dbec..e01199eee 100644
--- a/py/vmentrytable.h
+++ b/py/vmentrytable.h
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/vstr.c b/py/vstr.c
index 91cd7f584..ccc567d10 100644
--- a/py/vstr.c
+++ b/py/vstr.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/py/warning.c b/py/warning.c
index 12d0f9c99..d516eabdd 100644
--- a/py/warning.c
+++ b/py/warning.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2014 Damien P. George
+ * SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal