Skip to content

Fix deepcopy crash when uploading file with labels#356

Merged
dkliban merged 1 commit into
pulp:mainfrom
dkliban:fix/upload-deepcopy
Jun 26, 2026
Merged

Fix deepcopy crash when uploading file with labels#356
dkliban merged 1 commit into
pulp:mainfrom
dkliban:fix/upload-deepcopy

Conversation

@dkliban

@dkliban dkliban commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Fix TypeError: cannot pickle '_hashlib.HASH' object when uploading a file with pulp_labels via the synchronous upload endpoint
  • QueryDict.copy() does a deep copy which fails on uploaded files with hashers — use _mutable flag to modify pulp_labels in place instead
  • Add pulp_labels to the file upload test to cover this code path

Test plan

  • test_upload_maven_artifact_with_file — now uploads with pulp_labels={"type": "jar", "source": "test"} and verifies labels are stored

🤖 Generated with Claude Code

QueryDict.copy() fails with TypeError when the request contains uploaded
files with hashers (_hashlib.HASH objects cannot be pickled). Use
_mutable flag instead to modify pulp_labels in place.

Also adds labels to the file upload test to cover this code path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dkliban dkliban force-pushed the fix/upload-deepcopy branch from c152988 to 64ef486 Compare June 26, 2026 05:35
@dkliban dkliban merged commit ae4d2c0 into pulp:main Jun 26, 2026
14 checks passed
@patchback

patchback Bot commented Jun 26, 2026

Copy link
Copy Markdown

Backport to 0.16: 💚 backport PR created

✅ Backport PR branch: patchback/backports/0.16/ae4d2c048b41948e94b6872d2490f277b79b8afa/pr-356

Backported as #357

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant