-
-
Notifications
You must be signed in to change notification settings - Fork 500
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
What's wrong
#2654 removed BytesIO
inheritance from HttpRequest
which clashes with parse_file_upload
signature.
def parse_file_upload(
self, META: Mapping[str, Any], post_data: BinaryIO
)
A HttpRequest
instance used to be allowed as a post_data
value. But not anymore:
error: Argument 2 to "parse_file_upload" of "HttpRequest" has incompatible type "HttpRequest"; expected "BinaryIO" [arg-type]
How is that should be
A HttpRequest
instance should be a legitimate post_data
value, as seen in HttpRequest._load_and_post_files
method:
if hasattr(self, "_body"):
# Use already read data
data = BytesIO(self._body)
else:
data = self
try:
self._post, self._files = self.parse_file_upload(self.META, data)
except (MultiPartParserError, TooManyFilesSent):
...
System information
- OS: debian
python
3.12django
5.2mypy
1.16.1django-stubs
5.2.1django-stubs-ext
5.2.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working