Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
69eca4090b
@ -1694,7 +1694,7 @@ msgid "Only one color can be transparent at a time"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: shared-bindings/ipaddress/__init__.c
|
#: shared-bindings/ipaddress/__init__.c
|
||||||
msgid "Only raw int supported for ip"
|
msgid "Only raw int or string supported for ip"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
|
#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c
|
||||||
|
@ -60,12 +60,13 @@ STATIC mp_obj_t ipaddress_ipv4address_make_new(const mp_obj_type_t *type, size_t
|
|||||||
uint8_t *buf = NULL;
|
uint8_t *buf = NULL;
|
||||||
if (mp_obj_get_int_maybe(address, (mp_int_t *)&value)) {
|
if (mp_obj_get_int_maybe(address, (mp_int_t *)&value)) {
|
||||||
// We're done.
|
// We're done.
|
||||||
buf = (uint8_t *)value;
|
buf = (uint8_t *)&value;
|
||||||
} else if (mp_obj_is_str(address)) {
|
} else if (mp_obj_is_str(address)) {
|
||||||
GET_STR_DATA_LEN(address, str_data, str_len);
|
GET_STR_DATA_LEN(address, str_data, str_len);
|
||||||
if (!ipaddress_parse_ipv4address((const char *)str_data, str_len, &value)) {
|
if (!ipaddress_parse_ipv4address((const char *)str_data, str_len, &value)) {
|
||||||
mp_raise_ValueError(translate("Not a valid IP string"));
|
mp_raise_ValueError(translate("Not a valid IP string"));
|
||||||
}
|
}
|
||||||
|
buf = (uint8_t *)&value;
|
||||||
} else {
|
} else {
|
||||||
mp_buffer_info_t buf_info;
|
mp_buffer_info_t buf_info;
|
||||||
if (mp_get_buffer(address, &buf_info, MP_BUFFER_READ)) {
|
if (mp_get_buffer(address, &buf_info, MP_BUFFER_READ)) {
|
||||||
|
@ -76,7 +76,7 @@ bool ipaddress_parse_ipv4address(const char *str_data, size_t str_len, uint32_t
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//| def ip_address(obj: Union[int]) -> IPv4Address:
|
//| def ip_address(obj: Union[int, str]) -> IPv4Address:
|
||||||
//| """Return a corresponding IP address object or raise ValueError if not possible."""
|
//| """Return a corresponding IP address object or raise ValueError if not possible."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
@ -91,7 +91,7 @@ STATIC mp_obj_t ipaddress_ip_address(mp_obj_t ip_in) {
|
|||||||
mp_raise_ValueError(translate("Not a valid IP string"));
|
mp_raise_ValueError(translate("Not a valid IP string"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mp_raise_ValueError(translate("Only raw int supported for ip"));
|
mp_raise_ValueError(translate("Only raw int or string supported for ip"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return common_hal_ipaddress_new_ipv4address(value);
|
return common_hal_ipaddress_new_ipv4address(value);
|
||||||
|
Loading…
Reference in New Issue
Block a user