Skip to content

Commit c2fa512

Browse files
committed
Merge remote-tracking branch 'origin/master' into moat
2 parents 0147697 + b379e4f commit c2fa512

File tree

14 files changed

+55
-23
lines changed

14 files changed

+55
-23
lines changed

micropython/aioespnow/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ A small async server example::
5555
import asyncio
5656

5757
# A WLAN interface must be active to send()/recv()
58-
network.WLAN(network.STA_IF).active(True)
58+
network.WLAN(network.WLAN.IF_STA).active(True)
5959

6060
e = aioespnow.AIOESPNow() # Returns AIOESPNow enhanced with async support
6161
e.active(True)

micropython/mip/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
metadata(version="0.3.0", description="On-device package installer for network-capable boards")
1+
metadata(version="0.4.0", description="On-device package installer for network-capable boards")
22

33
require("requests")
44

micropython/mip/mip/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
_PACKAGE_INDEX = const("https://micropython.org/pi/v2")
1010
_CHUNK_SIZE = 128
1111

12+
allowed_mip_url_prefixes = ("http://", "https://", "github:", "gitlab:")
13+
1214

1315
# This implements os.makedirs(os.dirname(path))
1416
def _ensure_path_exists(path):
@@ -124,8 +126,12 @@ def _install_json(package_json_url, index, target, version, mpy):
124126
if not _download_file(file_url, fs_target_path):
125127
print("File not found: {} {}".format(target_path, short_hash))
126128
return False
129+
base_url = package_json_url.rpartition("/")[0]
127130
for target_path, url in package_json.get("urls", ()):
128131
fs_target_path = target + "/" + target_path
132+
is_full_url = any(url.startswith(p) for p in allowed_mip_url_prefixes)
133+
if base_url and not is_full_url:
134+
url = f"{base_url}/{url}" # Relative URLs
129135
if not _download_file(_rewrite_url(url, version), fs_target_path):
130136
print("File not found: {} {}".format(target_path, url))
131137
return False
@@ -136,12 +142,7 @@ def _install_json(package_json_url, index, target, version, mpy):
136142

137143

138144
def _install_package(package, index, target, version, mpy):
139-
if (
140-
package.startswith("http://")
141-
or package.startswith("https://")
142-
or package.startswith("github:")
143-
or package.startswith("gitlab:")
144-
):
145+
if any(package.startswith(p) for p in allowed_mip_url_prefixes):
145146
if package.endswith(".py") or package.endswith(".mpy"):
146147
print("Downloading {} to {}".format(package, target))
147148
return _download_file(

micropython/net/webrepl/webrepl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def setup_conn(port, accept_handler):
102102
listen_s.listen(1)
103103
if accept_handler:
104104
listen_s.setsockopt(socket.SOL_SOCKET, 20, accept_handler)
105-
for i in (network.AP_IF, network.STA_IF):
105+
for i in (network.WLAN.IF_AP, network.WLAN.IF_STA):
106106
iface = network.WLAN(i)
107107
if iface.active():
108108
print("WebREPL server started on http://%s:%d/" % (iface.ifconfig()[0], port))

micropython/umqtt.simple/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
metadata(description="Lightweight MQTT client for MicroPython.", version="1.4.0")
1+
metadata(description="Lightweight MQTT client for MicroPython.", version="1.5.0")
22

33
# Originally written by Paul Sokolovsky.
44

micropython/umqtt.simple/umqtt/simple.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ def set_last_will(self, topic, msg, retain=False, qos=0):
6060
self.lw_qos = qos
6161
self.lw_retain = retain
6262

63-
def connect(self, clean_session=True):
63+
def connect(self, clean_session=True, timeout=None):
6464
self.sock = socket.socket()
65+
self.sock.settimeout(timeout)
6566
addr = socket.getaddrinfo(self.server, self.port)[0][-1]
6667
self.sock.connect(addr)
6768
if self.ssl:

python-ecosys/requests/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
metadata(version="0.10.0", pypi="requests")
1+
metadata(version="0.10.1", pypi="requests")
22

33
package("requests")

python-ecosys/requests/requests/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def request(
4646
):
4747
if headers is None:
4848
headers = {}
49+
else:
50+
headers = headers.copy()
4951

5052
redirect = None # redirection url, None means no redirection
5153
chunked_data = data and getattr(data, "__next__", None) and not getattr(data, "__len__", None)

python-ecosys/requests/test_requests.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ def chunks():
102102

103103
def test_overwrite_get_headers():
104104
response = requests.request(
105-
"GET", "http://example.com", headers={"Connection": "keep-alive", "Host": "test.com"}
105+
"GET", "http://example.com", headers={"Host": "test.com", "Connection": "keep-alive"}
106106
)
107107

108108
assert response.raw._write_buffer.getvalue() == (
109-
b"GET / HTTP/1.0\r\n" + b"Host: test.com\r\n" + b"Connection: keep-alive\r\n\r\n"
109+
b"GET / HTTP/1.0\r\n" + b"Connection: keep-alive\r\n" + b"Host: test.com\r\n\r\n"
110110
), format_message(response)
111111

112112

@@ -145,6 +145,14 @@ def chunks():
145145
), format_message(response)
146146

147147

148+
def test_do_not_modify_headers_argument():
149+
global do_not_modify_this_dict
150+
do_not_modify_this_dict = {}
151+
requests.request("GET", "http://example.com", headers=do_not_modify_this_dict)
152+
153+
assert do_not_modify_this_dict == {}, do_not_modify_this_dict
154+
155+
148156
test_simple_get()
149157
test_get_auth()
150158
test_get_custom_header()
@@ -153,3 +161,4 @@ def chunks():
153161
test_overwrite_get_headers()
154162
test_overwrite_post_json_headers()
155163
test_overwrite_post_chunked_data_headers()
164+
test_do_not_modify_headers_argument()

python-stdlib/unittest/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
metadata(version="0.10.3")
1+
metadata(version="0.10.4")
22

33
package("unittest")

0 commit comments

Comments
 (0)