Skip to content

Restore order_by_precedence from 3.18.1 to fix broken return value - #10066

Merged
browniebroke merged 1 commit into
encode:mainfrom
browniebroke:fix/restore-media-types-order-by-preference
Oct 6, 2026
Merged

browniebroke merged 1 commit into
encode:mainfrom
browniebroke:fix/restore-media-types-order-by-preference

Conversation

@browniebroke

Copy link
Copy Markdown
Member

Description

In 148ab65 we inadvertently broke the return value of order_by_precedence from a list[set[str]] to a list[set[_MediaType]] by trying to reuse some logic. This function is actually no longer used hence why it went unnoticed. Restoring the old function as it was before.

@browniebroke browniebroke changed the title Restore order_by_precedence from 3.18.1 Restore order_by_precedence from 3.18.1 to fix broken return value Oct 6, 2026
@browniebroke
browniebroke merged commit e140de7 into encode:main Oct 6, 2026
8 checks passed
@browniebroke
browniebroke deleted the fix/restore-media-types-order-by-preference branch October 6, 2026 21:21
@auvipy auvipy added this to the 3.18 milestone Oct 7, 2026
"""
media_types_gen = (_MediaType(mt) for mt in media_type_lst)
return order_parsed_by_precedence(media_types_gen)
ret = [set(), set(), set(), set()]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are the change covered by tests already?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, and this function isn't used anymore in our codebase, so we need to add a deprecation for it, not sure it's worth writing tests. This is a partial revert of 148ab65#diff-82fcd731ec72549bfb31e9ea159677c198bc8996b39b514db4fe0c9b6a5a0914 btw

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecation would be fine

HosseinSayyedMousavi pushed a commit to HosseinSayyedMousavi/django-rest-framework that referenced this pull request Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants