#1133917 asgi-csrf: FTBFS with python-multipart 0.0.26-1

Package:
src:asgi-csrf
Source:
src:asgi-csrf
Submitter:
Alexandre Detiste
Date:
2026-06-03 14:35:05 UTC
Severity:
normal
Tags:
#1133917#5
Date:
2026-04-15 17:21:05 UTC
From:
To:
Hi,

asgi-csrf is not compatible with the new python-multipart

 38s E       TypeError: FormParser.__init__() got an unexpected keyword argument 'FileClass'


https://github.com/simonw/asgi-csrf/issues/38

Greetings

Alexandre




38s tests/test_asgi_csrf.py::test_multipart FAILED                           [ 27%]
 38s
 38s =================================== FAILURES ===================================
 38s ________________________________ test_multipart ________________________________
 38s
 38s csrftoken = 'InRva2VuIg.49BUIh1HVBjcyCpg_4018iFDFdY'
 38s
 38s     @pytest.mark.asyncio
 38s     async def test_multipart(csrftoken):
 38s         async with httpx.AsyncClient(
 38s             transport=httpx.ASGITransport(
 38s                 app=asgi_csrf(hello_world_app, signing_secret=SECRET)
 38s             ),
 38s             cookies={"csrftoken": csrftoken},
 38s         ) as client:
 38s >           response = await client.post(
 38s                 "http://localhost/",
 38s                 data={"csrftoken": csrftoken},
 38s                 files={"csv": ("data.csv", "blah,foo\n1,2", "text/csv")},
 38s             )
 38s
 38s tests/test_asgi_csrf.py:238:
 38s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 38s /usr/lib/python3/dist-packages/httpx/_client.py:1859: in post
 38s     return await self.request(
 38s /usr/lib/python3/dist-packages/httpx/_client.py:1540: in request
 38s     return await self.send(request, auth=auth, follow_redirects=follow_redirects)
 38s            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 38s /usr/lib/python3/dist-packages/httpx/_client.py:1629: in send
 38s     response = await self._send_handling_auth(
 38s /usr/lib/python3/dist-packages/httpx/_client.py:1657: in _send_handling_auth
 38s     response = await self._send_handling_redirects(
 38s /usr/lib/python3/dist-packages/httpx/_client.py:1694: in _send_handling_redirects
 38s     response = await self._send_single_request(request)
 38s                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 38s /usr/lib/python3/dist-packages/httpx/_client.py:1730: in _send_single_request
 38s     response = await transport.handle_async_request(request)
 38s                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 38s /usr/lib/python3/dist-packages/httpx/_transports/asgi.py:170: in handle_async_request
 38s     await self.app(scope, receive, send)
 38s /usr/lib/python3/dist-packages/asgi_csrf.py:198: in app_wrapped_with_csrf
 38s     ) = await _parse_multipart_form_data(boundary, receive)
 38s         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 38s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 38s
 38s boundary = b'd1ebe15d38a194610e63bb805c28d70d'
 38s receive = <function ASGITransport.handle_async_request.<locals>.receive at 0x7faa72786da0>
 38s
 38s     async def _parse_multipart_form_data(boundary, receive):
 38s         # Returns (csrftoken, replay_receive) - or raises an exception
 38s         csrftoken = None
 38s
 38s         def on_field(field):
 38s             if field.field_name == b"csrftoken":
 38s                 csrftoken = field.value.decode("utf-8")
 38s                 raise TokenFound(csrftoken)
 38s
 38s         class ErrorOnWrite:
 38s             def __init__(self, file_name, field_name, config):
 38s                 pass
 38s
 38s             def write(self, data):
 38s                 raise FileBeforeToken
 38s
 38s         body = b""
 38s         more_body = True
 38s         messages = []
 38s
 38s         async def replay_receive():
 38s             if messages:
 38s                 return messages.pop(0)
 38s             else:
 38s                 return await receive()
 38s
 38s >       form_parser = FormParser(
 38s             "multipart/form-data",
 38s             on_field,
 38s             lambda: None,
 38s             boundary=boundary,
 38s             FileClass=ErrorOnWrite,
 38s         )
 38s E       TypeError: FormParser.__init__() got an unexpected keyword argument 'FileClass'
 38s

#1133917#16
Date:
2026-06-03 14:34:01 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
asgi-csrf, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1133917@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Emmanuel Arias <eamanu@debian.org> (supplier of updated asgi-csrf package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Wed, 03 Jun 2026 10:24:46 -0300
Source: asgi-csrf
Architecture: source
Version: 0.11-3
Distribution: unstable
Urgency: medium
Maintainer: Debian Python Team <team+python@tracker.debian.org>
Changed-By: Emmanuel Arias <eamanu@debian.org>
Closes: 1133917
Changes:
 asgi-csrf (0.11-3) unstable; urgency=medium
 .
   * Team upload.
   * Packaging update (routine-update)
   * d/patches/fix-formparser-call.patch: Add patch to fix a old
     python-multipart api call (Closes: #1133917).
Checksums-Sha1:
 8b0fc4f3cd426a0cdffc7933cb3cf756f6e131a2 2430 asgi-csrf_0.11-3.dsc
 3e84caeb46aada4a2b15105a1d4557eb5a48a534 3420 asgi-csrf_0.11-3.debian.tar.xz
 50c0a8c0ac1a024a2df122d33339d106ebdcf30b 7631 asgi-csrf_0.11-3_amd64.buildinfo
Checksums-Sha256:
 4e029eb3e498e9e53951c768705755049524766da23b3bf898077c30a77bfafe 2430 asgi-csrf_0.11-3.dsc
 a5f7561def7c1fdfe0cd17a6b8cb9d6d340aaec4216149748d548653262b6aeb 3420 asgi-csrf_0.11-3.debian.tar.xz
 79b28949a0d1b48b0ca03d64f79afc676d6c4f3e106592a91d2462a1f7adb63b 7631 asgi-csrf_0.11-3_amd64.buildinfo
Files:
 2872b3776bac38841575f38b8e1518c0 2430 python optional asgi-csrf_0.11-3.dsc
 4db738669de27d2d209419aad1c8840b 3420 python optional asgi-csrf_0.11-3.debian.tar.xz
 e948505c577ab8064133dee9dbab607a 7631 python optional asgi-csrf_0.11-3_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJGBAEBCgAwFiEEE3lnVbvHK7ir4q61+p3sXeEcY/EFAmogMtESHGVhbWFudUBk
ZWJpYW4ub3JnAAoJEPqd7F3hHGPxZvEP/i9762yttWXLkVh0tlw2ED84uLLGgS/a
CugTseg2IBnq7Ps0jRoxvzibeXADuVRLj3h5aOYQZVWp/aKv4ABzQF3wo89aU7mv
QYLKlbeiVsq8srUy6LyvLSIG7av5UTtG7N2B5Er3U2DBU0t0nKPQ/PPMyEPf9MhK
SuIKJR+lMwukatckKLFp1jXZQLlCAx33hks98yepyaHeGm9Wo/mQUW1HC0OIyhSF
EVWelI7YOZ2GCLaBPlzgD4VdcGHipluLlNHVteoLFW0KIb6V/RL69HEr+OCIu9j4
MbNbLU4MthbGHb1/Yj/qR1dXfNoYML+IvvG99RwiExCeeSB6+M4xxQrTcnlCBTZ+
Iffxme8NS8IlD6FHwcgv2tzhHsFBisdQozCJj7gwF2GmUVoMLV0YxUKALNV63Ils
yJZQl83M/jVTNeByNu8VuB3NSvtGJsJBHQFYCLoLX5PPz/L3QOBsHhDDWvunWeZB
veKugpcjCUxosNgclhlsqooxAcY0bJyKyb5WL2EY/5eF/+xp2Vhrc1+SUjYw1MAa
97M0UU2ts+pX156crBkMfXygZ34oR1qO5t4GZ3go9mCfeYsljvqD3eijZFzeSlRL
I5a8B8pQ6Qz4a4YATrifnGZ9cOal34zpj4tQbMUYfvCIKlqU5Aau4TQFhD+e3Ucj
HanfkVvY0E6H
=jTVf
-----END PGP SIGNATURE-----