Skip to content

ReturnDict fails with union operator (PEP 584) #8301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 3 tasks
spookylukey opened this issue Dec 17, 2021 · 1 comment
Closed
2 of 3 tasks

ReturnDict fails with union operator (PEP 584) #8301

spookylukey opened this issue Dec 17, 2021 · 1 comment

Comments

@spookylukey
Copy link
Contributor

spookylukey commented Dec 17, 2021

Simplest case. Under Python 3.9:

>>> from rest_framework.serializers import Serializer
>>> Serializer().data | {}

Expected output:

{}

Actual behaviour:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luke/devel/django-rest-framework/rest_framework/utils/serializer_helpers.py", line 17, in __init__
    self.serializer = kwargs.pop('serializer')
KeyError: 'serializer'

I will provide a PR soon.

Checklist

  • I did not raise a discussion, as this is obviously a bug
  • This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
  • I have reduced the issue to the simplest possible case.
@tomchristie
Copy link
Member

Closed via 8302

sigvef pushed a commit to sigvef/django-rest-framework that referenced this issue Dec 3, 2022
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

No branches or pull requests

2 participants