Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] fix failed import Mapping on python 3.10 #16339

Merged
merged 1 commit into from
Mar 17, 2022

Conversation

Kxuan
Copy link
Contributor

@Kxuan Kxuan commented Mar 17, 2022

Signed-off-by: kXuan kxuanobj@gmail.com

Problem

  • Fix python controller failed on python 3.10
Traceback (most recent call last):
  File "/data/work/oppo/matter/oppo-lamp/third_party/connectedhomeip/src/app/ota_image_tool.py", line 41, in <module>
    from chip.tlv import TLVReader, TLVWriter, uint  # noqa: E402
  File "/data/work/oppo/matter/oppo-lamp/third_party/connectedhomeip/src/app/../controller/python/chip/tlv/__init__.py", line 32, in <module>
    from collections import Mapping, Sequence, OrderedDict
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Change overview

Python 3.10 has removed some alias from collections module. Python 3.10 What's New:

Remove deprecated aliases to Collections Abstract Base Classes from the collections module. (Contributed by Victor Stinner in bpo-37324.)

The python controller still use deprecated aliases, so it failed on python 3.10.

This patch fix this problem by import Mapping, Sequence from collections.abc.

Testing

How was this tested? (at least one bullet point required)

  • Test locally by build ESP32 Ota Requestor demo with a python 3.10 installed system.

Signed-off-by: kXuan <kxuanobj@gmail.com>
@CLAassistant
Copy link

CLAassistant commented Mar 17, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

github-actions bot commented Mar 17, 2022

PR #16339: Size comparison from d80d593 to fd67123

Full report (18 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section d80d593 fd67123 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 603418 603418 0 0.0
.app_xip_area 510516 510516 0 0.0
.bss 75656 75656 0 0.0
.data 596 596 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 561206 561206 0 0.0
.app_xip_area 469832 469832 0 0.0
.bss 74160 74160 0 0.0
.data 560 560 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 571010 571010 0 0.0
.app_xip_area 469988 469988 0 0.0
.bss 83464 83464 0 0.0
.data 520 520 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 920940 920940 0 0.0
(read/write) 128752 128752 0 0.0
.bss 126744 126744 0 0.0
.data 2008 2008 0 0.0
.text 920932 920932 0 0.0
BRD4161A+rpc (read only) 949744 949744 0 0.0
(read/write) 144712 144712 0 0.0
.bss 142520 142520 0 0.0
.data 2188 2188 0 0.0
.text 949736 949736 0 0.0
window-app BRD4161A (read only) 851692 851692 0 0.0
(read/write) 126704 126704 0 0.0
.bss 124840 124840 0 0.0
.data 1864 1864 0 0.0
.text 851684 851684 0 0.0
esp32 all-clusters-app c3devkit (read only) 961328 961328 0 0.0
(read/write) 1394818 1394818 0 0.0
.dram0.bss 64048 64048 0 0.0
.dram0.data 14188 14188 0 0.0
.flash.rodata 197672 197672 0 0.0
.flash.text 961328 961328 0 0.0
.iram0.text 62016 62016 0 0.0
m5stack (read only) 1017295 1017295 0 0.0
(read/write) 462484 462484 0 0.0
.dram0.bss 69576 69576 0 0.0
.dram0.data 34016 34016 0 0.0
.flash.rodata 227056 227056 0 0.0
.flash.text 1011911 1011911 0 0.0
.iram0.text 123107 123107 0 0.0
k32w light k32w061+release (read/write) 700096 700096 0 0.0
.bss 77632 77632 0 0.0
.data 1888 1888 0 0.0
.text 614776 614776 0 0.0
lock k32w061+release (read/write) 700392 700392 0 0.0
.bss 77624 77624 0 0.0
.data 1908 1908 0 0.0
.text 615060 615060 0 0.0
linux chip-tool-ipv6only arm64 (read only) 9754676 9754676 0 0.0
(read/write) 475505 475505 0 0.0
.bss 44033 44033 0 0.0
.data 1128 1128 0 0.0
.data.rel.ro 371288 371288 0 0.0
.dynamic 560 560 0 0.0
.got 55264 55264 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 492460 492460 0 0.0
.text 8212228 8212228 0 0.0
thermostat-no-ble arm64 (read only) 2220364 2220364 0 0.0
(read/write) 149809 149809 0 0.0
.bss 65713 65713 0 0.0
.data 1024 1024 0 0.0
.data.rel.ro 75728 75728 0 0.0
.dynamic 560 560 0 0.0
.got 4352 4352 0 0.0
.init 24 24 0 0.0
.init_array 360 360 0 0.0
.rodata 137772 137772 0 0.0
.text 1862528 1862528 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2352364 2352364 0 0.0
.bss 186644 186644 0 0.0
.data 5752 5752 0 0.0
.text 1314964 1314964 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1154799 1154799 0 0.0
bss 146724 146724 0 0.0
rodata 145536 145536 0 0.0
text 787376 787376 0 0.0
p6 all-clusters-app default (read/write) 2491648 2491648 0 0.0
.bss 120072 120072 0 0.0
.data 2632 2632 0 0.0
.text 1449912 1449912 0 0.0
light-app default (read/write) 2395512 2395512 0 0.0
.bss 113536 113536 0 0.0
.data 2488 2488 0 0.0
.text 1353776 1353776 0 0.0
lock-app default (read/write) 2359056 2359056 0 0.0
.bss 113280 113280 0 0.0
.data 2448 2448 0 0.0
.text 1317320 1317320 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 894938 894938 0 0.0
bss 87432 87432 0 0.0
noinit 37160 37160 0 0.0
text 632758 632758 0 0.0

@bzbarsky-apple bzbarsky-apple merged commit e5c5a9e into project-chip:master Mar 17, 2022
ArekBalysNordic pushed a commit to ArekBalysNordic/connectedhomeip that referenced this pull request Mar 18, 2022
andrei-menzopol pushed a commit to andrei-menzopol/connectedhomeip that referenced this pull request Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants