Fix type error in S3 backend caused by key / task ID#5721
Merged
auvipy merged 2 commits intocelery:masterfrom Sep 10, 2019
MrSaints:fix-s3-backend-typeerror
Merged
Fix type error in S3 backend caused by key / task ID#5721auvipy merged 2 commits intocelery:masterfrom MrSaints:fix-s3-backend-typeerror
auvipy merged 2 commits intocelery:masterfrom
MrSaints:fix-s3-backend-typeerror
Conversation
This is to test setting, and retrieving a key as bytes in addition to string. The current S3 backend does not support the former despite the internals of Celery mostly representing the key as bytes.
… only concatenate str (not "bytes") to str` The task ID is handled internally as "bytes", but it is being treated as a string. This commit follows the `couchdb` backend implementation by converting the key from "bytes" to "string" using kombu's `bytes_to_str`.
Member
|
any related issue? |
Contributor
Author
|
@auvipy Not that I am aware of. |
auvipy
approved these changes
Sep 10, 2019
jeyrce
pushed a commit
to jeyrce/celery
that referenced
this pull request
Aug 25, 2021
* Update S3 backend test to include `key` as bytes in addition to string This is to test setting, and retrieving a key as bytes in addition to string. The current S3 backend does not support the former despite the internals of Celery mostly representing the key as bytes. * Fix type error in S3 backend: `Invalid type for parameter Key` / `can only concatenate str (not "bytes") to str` The task ID is handled internally as "bytes", but it is being treated as a string. This commit follows the `couchdb` backend implementation by converting the key from "bytes" to "string" using kombu's `bytes_to_str`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The S3 backend for Celery was introduced in cd6c744. The key received by
def get(self, key), anddef set(self, key, value)however, is of typebytescausing one of the following exceptions in Python 3.7:OR...
This PR introduces test parameters that would have caught the "bug", and a fix that addresses the failing test.