Skip to content

Commit 4683f27

Browse files
authored
Merge pull request #10931 from dhalbert/micropython-v1.27-merge
Micropython v1.27 merge
2 parents ef6124d + 6caff40 commit 4683f27

File tree

678 files changed

+14806
-5078
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

678 files changed

+14806
-5078
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@
2727
# These should also not be modified by git.
2828
tests/basics/string_cr_conversion.py -text
2929
tests/basics/string_crlf_conversion.py -text
30+
tests/micropython/test_normalize_newlines.py.exp -text
3031
# CIRCUITPY-CHANGE: remove non-CircuitPython tests

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
repos:
1111
- repo: https://github.com/pre-commit/pre-commit-hooks
12-
rev: v5.0.0
12+
rev: v6.0.0
1313
hooks:
1414
- id: check-yaml
1515
- id: end-of-file-fixer
@@ -55,14 +55,14 @@ repos:
5555
language: python
5656
- repo: https://github.com/astral-sh/ruff-pre-commit
5757
# Ruff version.
58-
rev: v0.9.4
58+
rev: v0.15.7
5959
hooks:
6060
# Run the linter.
6161
- id: ruff
6262
args: [ --fix ]
6363
# Run the formatter.
6464
- id: ruff-format
6565
- repo: https://github.com/tox-dev/pyproject-fmt
66-
rev: "v2.5.0"
66+
rev: "v2.21.0"
6767
hooks:
6868
- id: pyproject-fmt

LICENSE_MicroPython

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2013-2024 Damien P. George
3+
Copyright (c) 2013-2025 Damien P. George
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,5 +375,6 @@ coverage-fresh:
375375
make -j -C ports/unix VARIANT=coverage
376376

377377
.PHONY: run-tests
378+
# If TESTS="abc.py def.py" is specified as an arg, run only those tests. Otherwise, run all tests.
378379
run-tests:
379-
cd tests; MICROPY_MICROPYTHON=../ports/unix/build-coverage/micropython ./run-tests.py
380+
cd tests; MICROPY_MICROPYTHON=../ports/unix/build-coverage/micropython ./run-tests.py $(TESTS)

docs/library/collections.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,19 @@ Classes
109109
a 2
110110
w 5
111111
b 3
112+
113+
.. method:: OrderedDict.popitem()
114+
115+
Remove and return a (key, value) pair from the dictionary.
116+
Pairs are returned in LIFO order.
117+
118+
.. admonition:: Difference to CPython
119+
:class: attention
120+
121+
``OrderedDict.popitem()`` does not support the ``last=False`` argument and
122+
will always remove and return the last item if present.
123+
124+
A workaround for this is to use ``pop(<first_key>)`` to remove the first item::
125+
126+
first_key = next(iter(d))
127+
d.pop(first_key)

docs/library/platform.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,11 @@ Functions
3636
Returns a tuple of strings *(lib, version)*, where *lib* is the name of the
3737
libc that MicroPython is linked to, and *version* the corresponding version
3838
of this libc.
39+
40+
.. function:: processor()
41+
42+
Returns a string with a detailed name of the processor, if one is available.
43+
If no name for the processor is known, it will return an empty string
44+
instead.
45+
46+
This is currently available only on RISC-V targets (both 32 and 64 bits).

docs/library/re.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,25 @@ Regex objects
154154
Compiled regular expression. Instances of this class are created using
155155
`re.compile()`.
156156

157-
.. method:: regex.match(string)
158-
regex.search(string)
157+
.. method:: regex.match(string, [pos, [endpos]])
158+
regex.search(string, [pos, [endpos]])
159159
regex.sub(replace, string, count=0, flags=0, /)
160160

161161
Similar to the module-level functions :meth:`match`, :meth:`search`
162162
and :meth:`sub`.
163163
Using methods is (much) more efficient if the same regex is applied to
164164
multiple strings.
165165

166+
The optional second parameter *pos* gives an index in the string where the
167+
search is to start; it defaults to ``0``. This is not completely equivalent
168+
to slicing the string; the ``'^'`` pattern character matches at the real
169+
beginning of the string and at positions just after a newline, but not
170+
necessarily at the index where the search is to start.
171+
172+
The optional parameter *endpos* limits how far the string will be searched;
173+
it will be as if the string is *endpos* characters long, so only the
174+
characters from *pos* to ``endpos - 1`` will be searched for a match.
175+
166176
.. method:: regex.split(string, max_split=-1, /)
167177

168178
Split a *string* using regex. If *max_split* is given, it specifies

docs/library/sys.rst

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,9 @@ Functions
1212
.. function:: exit(retval=0, /)
1313

1414
Terminate current program with a given exit code. Underlyingly, this
15-
function raise as `SystemExit` exception. If an argument is given, its
15+
function raises a `SystemExit` exception. If an argument is given, its
1616
value given as an argument to `SystemExit`.
1717

18-
.. function:: print_exception(exc, file=sys.stdout, /)
19-
20-
This function is deprecated and will be removed starting in
21-
CircuitPython 10.x, `traceback.print_exception()` should be used instead.
22-
23-
Print exception with a traceback to a file-like object *file* (or
24-
`sys.stdout` by default).
25-
2618
.. admonition:: Difference to CPython
2719
:class: attention
2820

@@ -52,6 +44,8 @@ Constants
5244
* *version* - tuple (major, minor, micro), e.g. (1, 7, 0)
5345
* *_machine* - string describing the underlying machine
5446
* *_mpy* - supported mpy file-format version (optional attribute)
47+
* *_build* - string that can help identify the configuration that
48+
MicroPython was built with
5549

5650
This object is the recommended way to distinguish CircuitPython from other
5751
Python implementations (note that it still may not exist in the very
@@ -116,15 +110,15 @@ Constants
116110

117111
.. data:: stderr
118112

119-
Standard error ``stream``.
113+
Standard error `stream`.
120114

121115
.. data:: stdin
122116

123-
Standard input ``stream``.
117+
Standard input `stream`.
124118

125119
.. data:: stdout
126120

127-
Standard output ``stream``.
121+
Standard output `stream`.
128122

129123
.. data:: version
130124

docs/reference/glossary.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ Glossary
186186
Most MicroPython boards make a REPL available over a UART, and this is
187187
typically accessible on a host PC via USB.
188188

189+
small integer
190+
MicroPython optimises the internal representation of integers such that
191+
"small" values do not take up space on the heap, and calculations with
192+
them do not require heap allocation. On most 32-bit ports, this
193+
corresponds to values in the interval ``-2**30 <= x < 2**30``, but this
194+
should be considered an implementation detail and not relied upon.
195+
189196
stream
190197
Also known as a "file-like object". A Python object which provides
191198
sequential read-write access to the underlying data. A stream object

extmod/extmod.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ endif
162162

163163
ifeq ($(MICROPY_VFS_LFS2),1)
164164
CFLAGS_EXTMOD += -DMICROPY_VFS_LFS2=1
165-
CFLAGS_THIRDPARTY += -DLFS2_NO_MALLOC -DLFS2_NO_DEBUG -DLFS2_NO_WARN -DLFS2_NO_ERROR -DLFS2_NO_ASSERT
165+
CFLAGS_THIRDPARTY += -DLFS2_NO_MALLOC -DLFS2_NO_DEBUG -DLFS2_NO_WARN -DLFS2_NO_ERROR -DLFS2_NO_ASSERT -DLFS2_DEFINES=extmod/littlefs-include/lfs2_defines.h
166166
SRC_THIRDPARTY_C += $(addprefix $(LITTLEFS_DIR)/,\
167167
lfs2.c \
168168
lfs2_util.c \
@@ -461,7 +461,7 @@ ESP_HOSTED_SRC_C = $(addprefix $(ESP_HOSTED_DIR)/,\
461461
)
462462

463463
ifeq ($(MICROPY_PY_BLUETOOTH),1)
464-
ESP_HOSTED_SRC_C += $(ESP_HOSTED_DIR)/esp_hosted_bthci.c
464+
ESP_HOSTED_SRC_C += $(ESP_HOSTED_DIR)/esp_hosted_bthci_uart.c
465465
endif
466466

467467
# Include the protobuf-c support functions

0 commit comments

Comments
 (0)