KWON BYUNGCHANG created BIGTOP-4540:
---------------------------------------
Summary: bigtop-select: distro-select "set all" fails with
TypeError: cannot pickle 'dict_keys' object on Python 3
Key: BIGTOP-4540
URL: https://issues.apache.org/jira/browse/BIGTOP-4540
Project: Bigtop
Issue Type: Bug
Reporter: KWON BYUNGCHANG
Running "distro-select set all <version>" fails on Python 3:
{code}
$ sudo ./distro-select set all 3.6.0
Traceback (most recent call last):
File "/usr/lib/bigtop-select/./distro-select", line 364, in <module>
createCommandSymlinks(pkgs, options.rpm_mode)
File "/usr/lib/bigtop-select/./distro-select", line 260, in
createCommandSymlinks
work_packages = copy.copy(packages)
File "/usr/lib64/python3.9/copy.py", line 92, in copy
rv = reductor(4)
TypeError: cannot pickle 'dict_keys' object
{code}
The "packages" argument is a dict_keys view (from dict.keys()). On Python 2
this was a list, so copy.copy() worked, but on Python 3 dict views are not
copyable via copy.copy() and the fallback pickle path fails.
Fix: convert the view to a list, e.g.
{code}
work_packages = list(packages)
{code}
Environment: Python 3.9 (EL9), Bigtop 3.7.0-SNAPSHOT.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)