diff --git a/extmod/modasyncio.c b/extmod/modasyncio.c index eb7fe2e734..4a02ada261 100644 --- a/extmod/modasyncio.c +++ b/extmod/modasyncio.c @@ -145,6 +145,11 @@ STATIC const mp_rom_map_elem_t task_queue_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_push), MP_ROM_PTR(&task_queue_push_obj) }, { MP_ROM_QSTR(MP_QSTR_pop), MP_ROM_PTR(&task_queue_pop_obj) }, { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&task_queue_remove_obj) }, + + // CIRCUITPY-CHANGE: Remove these in CircuitPython 10.0.0 + { MP_ROM_QSTR(MP_QSTR_push_head), MP_ROM_PTR(&task_queue_push_obj) }, + { MP_ROM_QSTR(MP_QSTR_push_sorted), MP_ROM_PTR(&task_queue_push_obj) }, + { MP_ROM_QSTR(MP_QSTR_pop_head), MP_ROM_PTR(&task_queue_pop_obj) }, }; STATIC MP_DEFINE_CONST_DICT(task_queue_locals_dict, task_queue_locals_dict_table); diff --git a/extmod/modjson.c b/extmod/modjson.c index d001f225a5..200258ce49 100644 --- a/extmod/modjson.c +++ b/extmod/modjson.c @@ -437,7 +437,7 @@ STATIC mp_obj_t mod_json_loads(mp_obj_t obj) { mp_get_buffer_raise(obj, &bufinfo, MP_BUFFER_READ); vstr_t vstr = {bufinfo.len, bufinfo.len, (char *)bufinfo.buf, true}; mp_obj_stringio_t sio = {{&mp_type_stringio}, &vstr, 0, MP_OBJ_NULL}; - return mod_json_load(MP_OBJ_FROM_PTR(&sio)); + return _mod_json_load(MP_OBJ_FROM_PTR(&sio), false); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_json_loads_obj, mod_json_loads); diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 24d0fc6be8..454f7db4e1 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -395,15 +395,7 @@ msgid "'await' outside function" msgstr "" #: py/compile.c -msgid "'await', 'async for' or 'async with' outside async function" -msgstr "" - -#: py/compile.c -msgid "'break' outside loop" -msgstr "" - -#: py/compile.c -msgid "'continue' outside loop" +msgid "'break'/'continue' outside loop" msgstr "" #: py/compile.c @@ -422,10 +414,6 @@ msgstr "" msgid "'return' outside function" msgstr "" -#: py/compile.c -msgid "'yield from' inside async function" -msgstr "" - #: py/compile.c msgid "'yield' outside function" msgstr "" @@ -965,7 +953,7 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "" -#: extmod/modure.c +#: extmod/modre.c msgid "Error in regex" msgstr "" @@ -1045,7 +1033,7 @@ msgstr "" msgid "Failed to write internal flash." msgstr "" -#: py/moduerrno.c +#: py/moderrno.c msgid "File exists" msgstr "" @@ -1180,7 +1168,7 @@ msgstr "" msgid "Input taking too long" msgstr "" -#: ports/espressif/common-hal/neopixel_write/__init__.c py/moduerrno.c +#: ports/espressif/common-hal/neopixel_write/__init__.c py/moderrno.c msgid "Input/output error" msgstr "" @@ -1259,7 +1247,7 @@ msgstr "" msgid "Invalid MAC address" msgstr "" -#: ports/espressif/common-hal/espidf/__init__.c py/moduerrno.c +#: ports/espressif/common-hal/espidf/__init__.c py/moderrno.c msgid "Invalid argument" msgstr "" @@ -1525,15 +1513,15 @@ msgstr "" msgid "No pulldown on pin; 1Mohm recommended" msgstr "" -#: py/moduerrno.c +#: py/moderrno.c msgid "No space left on device" msgstr "" -#: py/moduerrno.c +#: py/moderrno.c msgid "No such device" msgstr "" -#: py/moduerrno.c +#: py/moderrno.c msgid "No such file/directory" msgstr "" @@ -1654,7 +1642,7 @@ msgstr "" msgid "Only one color can be transparent at a time" msgstr "" -#: py/moduerrno.c +#: py/moderrno.c msgid "Operation not permitted" msgstr "" @@ -1708,7 +1696,7 @@ msgstr "" msgid "Peripheral in use" msgstr "" -#: py/moduerrno.c +#: py/moderrno.c msgid "Permission denied" msgstr "" @@ -1842,7 +1830,7 @@ msgstr "" msgid "Read-only" msgstr "" -#: extmod/vfs_fat.c py/moduerrno.c +#: extmod/vfs_fat.c py/moderrno.c msgid "Read-only filesystem" msgstr "" @@ -2403,7 +2391,7 @@ msgstr "" msgid "__new__ arg must be a user-type" msgstr "" -#: extmod/modubinascii.c extmod/moduhashlib.c py/objarray.c +#: extmod/modbinascii.c extmod/modhashlib.c py/objarray.c msgid "a bytes-like object is required" msgstr "" @@ -2477,6 +2465,10 @@ msgstr "" msgid "asm overflow" msgstr "" +#: py/compile.c +msgid "async for/with outside async function" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2529,7 +2521,7 @@ msgstr "" msgid "bitmap sizes must match" msgstr "" -#: extmod/modurandom.c +#: extmod/modrandom.c msgid "bits must be 32 or less" msgstr "" @@ -2610,11 +2602,11 @@ msgstr "" msgid "can't assign to expression" msgstr "" -#: extmod/moduasyncio.c +#: extmod/modasyncio.c msgid "can't cancel self" msgstr "" -#: py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2628,6 +2620,11 @@ msgstr "" msgid "can't convert %s to float" msgstr "" +#: py/runtime.c +#, c-format +msgid "can't convert %s to int" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "" @@ -2738,7 +2735,7 @@ msgstr "" msgid "can't unambiguously get sizeof scalar" msgstr "" -#: extmod/moduasyncio.c +#: extmod/modasyncio.c msgid "can't wait" msgstr "" @@ -2830,7 +2827,7 @@ msgstr "" msgid "complex values not supported" msgstr "" -#: extmod/moduzlib.c +#: extmod/modzlib.c msgid "compression header" msgstr "" @@ -2944,7 +2941,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c +#: extmod/modasyncio.c extmod/modheapq.c msgid "empty heap" msgstr "" @@ -3073,6 +3070,10 @@ msgstr "" msgid "font must be 2048 bytes long" msgstr "" +#: extmod/moddeflate.c +msgid "format" +msgstr "" + #: py/objstr.c msgid "format requires a dict" msgstr "" @@ -3149,11 +3150,11 @@ msgstr "" msgid "graphic must be 2048 bytes long" msgstr "" -#: extmod/moduhashlib.c +#: extmod/modhashlib.c msgid "hash is final" msgstr "" -#: extmod/moduheapq.c +#: extmod/modheapq.c msgid "heap must be a list" msgstr "" @@ -3185,7 +3186,7 @@ msgstr "" msgid "incomplete format key" msgstr "" -#: extmod/modubinascii.c +#: extmod/modbinascii.c msgid "incorrect padding" msgstr "" @@ -3314,7 +3315,7 @@ msgid "interval must be in range %s-%s" msgstr "" #: py/compile.c -msgid "invalid architecture" +msgid "invalid arch" msgstr "" #: shared-bindings/bitmaptools/__init__.c @@ -3503,6 +3504,10 @@ msgstr "" msgid "memoryview: length is not a multiple of itemsize" msgstr "" +#: extmod/modtime.c +msgid "mktime needs a tuple of length 8 or 9" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "mode must be complete, or reduced" msgstr "" @@ -3600,7 +3605,7 @@ msgstr "" msgid "no default packer" msgstr "" -#: extmod/modurandom.c +#: extmod/modrandom.c msgid "no default seed" msgstr "" @@ -4027,7 +4032,7 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: extmod/modure.c +#: extmod/modre.c msgid "splitting with sub-captures" msgstr "" @@ -4076,7 +4081,7 @@ msgstr "" msgid "super() can't find self" msgstr "" -#: extmod/modujson.c +#: extmod/modjson.c msgid "syntax error in JSON" msgstr "" @@ -4084,7 +4089,7 @@ msgstr "" msgid "syntax error in uctypes descriptor" msgstr "" -#: extmod/utime_mphal.c +#: extmod/modtime.c msgid "ticks interval overflow" msgstr "" @@ -4262,7 +4267,7 @@ msgid "unsupported format character '%c' (0x%x) at index %d" msgstr "" #: py/runtime.c -msgid "unsupported type for %q: '%q'" +msgid "unsupported type for %q: '%s'" msgstr "" #: py/runtime.c @@ -4290,6 +4295,10 @@ msgstr "" msgid "value out of range of target" msgstr "" +#: extmod/moddeflate.c +msgid "wbits" +msgstr "" + #: shared-bindings/is31fl3741/FrameBuffer.c msgid "width must be greater than zero" msgstr "" diff --git a/tests/extmod/asyncio_micropython.py b/tests/extmod/asyncio_micropython.py index 3985307043..cc96d34be2 100644 --- a/tests/extmod/asyncio_micropython.py +++ b/tests/extmod/asyncio_micropython.py @@ -40,4 +40,4 @@ async def main(): print("finish") -uasyncio.run(main()) +asyncio.run(main()) diff --git a/tests/run-tests.py b/tests/run-tests.py index 86a35ebc3a..4d738e8e37 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -715,13 +715,18 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): output_expected = f.read() else: # CIRCUITPY-CHANGE: set language & make sure testlib is available for `skip_ok`. - e = {"PYTHONPATH": "testlib", "PATH": os.environ["PATH"], "LANG": "en_US.UTF-8"} + e = { + "PYTHONPATH": base_path("testlib"), + "PATH": os.environ["PATH"], + "LANG": "en_US.UTF-8", + } # run CPython to work out expected output try: output_expected = subprocess.check_output( CPYTHON3_CMD + [os.path.abspath(test_file)], cwd=os.path.dirname(test_file), stderr=subprocess.STDOUT, + env=e, ) if args.write_exp: with open(test_file_expected, "wb") as f: @@ -1022,8 +1027,16 @@ the last matching regex is used: tests = args.files if not args.keep_path: - # clear search path to make sure tests use only builtin modules and those in extmod - os.environ["MICROPYPATH"] = ".frozen" + os.pathsep + base_path("../extmod") + # clear search path to make sure tests use only builtin modules and those that can be frozen + # CIRCUITPY-CHANGE: Add testlib for skip_if and our async stuff. + os.environ["MICROPYPATH"] = os.pathsep.join( + [ + ".frozen", + base_path("testlib"), + base_path("../frozen/Adafruit_CircuitPython_asyncio"), + base_path("../frozen/Adafruit_CircuitPython_Ticks"), + ] + ) try: os.makedirs(args.result_dir, exist_ok=True) diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 7c52eb19c8..01ef9beb97 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -15,12 +15,12 @@ false true abc % # GC -0 -0 +0x0 +0x0 # GC part 2 pass # tracked allocation -m_tracked_head = 0 +m_tracked_head = 0x0 0 1 1 1 2 1 @@ -37,7 +37,7 @@ m_tracked_head = 0 5 1 6 1 7 1 -m_tracked_head = 0 +m_tracked_head = 0x0 # vstr tests sts @@ -48,18 +48,18 @@ RuntimeError: RuntimeError: # repl ame__ -mport +port builtins micropython __future__ _asyncio _thread aesio array audiocore audiomixer binascii bitmaptools cexample cmath collections cppexample displayio -errno gc hashlib heapq -io json math os -platform qrio rainbowio random -re select struct synthio -sys time traceback uctypes -ulab zlib +errno example_package gc +hashlib heapq io json +math os platform qrio +rainbowio random re select +struct synthio sys time +traceback uctypes ulab zlib me rainbowio random