Skip to content

BIGTOP-4540. bigtop-select: distro-select "set all" fails with TypeEror: cannot pickle 'dict_keys' object on Python 3#1400

Open
magnuma3 wants to merge 1 commit into
apache:masterfrom
magnuma3:fix-distro-select
Open

BIGTOP-4540. bigtop-select: distro-select "set all" fails with TypeEror: cannot pickle 'dict_keys' object on Python 3#1400
magnuma3 wants to merge 1 commit into
apache:masterfrom
magnuma3:fix-distro-select

Conversation

@magnuma3

@magnuma3 magnuma3 commented Jul 9, 2026

Copy link
Copy Markdown

Description of PR

Running "distro-select set all " fails on Python 3:

$ 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

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.

work_packages = list(packages)

Environment: Python 3.9 (EL9), Bigtop 3.7.0-SNAPSHOT.

How was this patch tested?

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'BIGTOP-3638. Your PR title ...')?
  • Make sure that newly added files do not have any licensing issues. When in doubt refer to https://www.apache.org/licenses/

…ror: cannot pickle 'dict_keys' object on Python 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant