-
-
Notifications
You must be signed in to change notification settings - Fork 527
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
python3.12django5.2mypy1.16.1django-stubs5.2.1django-stubs-ext5.2.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working