Modify ↓
Opened 3 weeks ago
Closed 3 weeks ago
#13883 closed defect (fixed)
4 unit tests failed with Python 3.14
| Reported by: | Jun Omae | Owned by: | Jun Omae |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.6.1 |
| Component: | web frontend | Version: | 1.6 |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: |
Removed uses of |
||
Description (last modified by )
It seems the textwrap.dedent in Python 3.14 replaces CR LF line with LF line. I remove uses of textwrap.dedent from the failed tests.
======================================================================
ERROR: test_post_with_null_bytes_for_filename (trac.web.tests.api.RequestTestCase.test_post_with_null_bytes_for_filename)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jun66j5/src/tracdev/git/trac/web/tests/api.py", line 600, in test_post_with_null_bytes_for_filename
self._test_post_with_null_bytes(form_data)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/home/jun66j5/src/tracdev/git/trac/web/tests/api.py", line 579, in _test_post_with_null_bytes
req.args['action']
^^^^^^^^
File "/home/jun66j5/src/tracdev/git/trac/web/api.py", line 689, in __getattr__
value = self.callbacks[name](self)
File "/home/jun66j5/src/tracdev/git/trac/web/api.py", line 671, in <lambda>
'args': lambda req: arg_list_to_args(req.arg_list),
^^^^^^^^^^^^
File "/home/jun66j5/src/tracdev/git/trac/web/api.py", line 689, in __getattr__
value = self.callbacks[name](self)
File "/home/jun66j5/src/tracdev/git/trac/web/api.py", line 1046, in _parse_arg_list
return list(parse_form_data(self.environ))
File "/home/jun66j5/src/tracdev/git/trac/web/api.py", line 535, in parse_form_data
forms, files = multipart.parse_form_data(environ, charset='utf-8',
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
strict=True)
^^^^^^^^^^^^
File "/home/jun66j5/venv/py314/lib/python3.14/site-packages/multipart.py", line 840, in parse_form_data
for part in MultipartParser(stream, boundary, content_length, **kwargs):
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jun66j5/venv/py314/lib/python3.14/site-packages/multipart.py", line 622, in __iter__
for part in self._part_iter:
^^^^^^^^^^^^^^^
File "/home/jun66j5/venv/py314/lib/python3.14/site-packages/multipart.py", line 668, in _iterparse
for event in parser.parse(chunk):
~~~~~~~~~~~~^^^^^^^
File "/home/jun66j5/venv/py314/lib/python3.14/site-packages/multipart.py", line 347, in parse
self._current._add_headerline(buffer[offset:nl])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/home/jun66j5/venv/py314/lib/python3.14/site-packages/multipart.py", line 489, in _add_headerline
raise self._fail("Malformed segment header")
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jun66j5/venv/py314/lib/python3.14/site-packages/multipart.py", line 406, in _fail
raise err
multipart.MultipartError: Malformed segment header
----------------------------------------------------------------------
Ran 2817 tests in 33.141s
FAILED (errors=4, skipped=5)
test-textwrap.py
import textwrap def main(): form_data = textwrap.dedent("""\ --%(boundary)s\r\n\ Content-Disposition: form-data; name="attachment"; \ filename="thefi\x00le.txt"\r\n\ Content-Type: text/plain\r\n\ \r\n\ The file content.\r\n\ --%(boundary)s\r\n\ Content-Disposition: form-data; name="action"\r\n\ \r\n\ new\r\n\ --%(boundary)s--\r\n\ """) print(repr(form_data).replace('\\n', '\\n\n')) if __name__ == '__main__': main()
diff between 3.13 and 3.14
$ diff -u <(python3.13 test-textwrap.py) <(python3.14 test-textwrap.py) --- /dev/fd/63 2025-10-13 07:43:11.952061732 +0900 +++ /dev/fd/62 2025-10-13 07:43:11.952061732 +0900 @@ -1,11 +1,11 @@ '--%(boundary)s\r\n Content-Disposition: form-data; name="attachment"; filename="thefi\x00le.txt"\r\n Content-Type: text/plain\r\n -\r\n +\n The file content.\r\n --%(boundary)s\r\n Content-Disposition: form-data; name="action"\r\n -\r\n +\n new\r\n --%(boundary)s--\r\n '
Attachments (0)
Change History (2)
comment:1 by , 3 weeks ago
| Description: | modified (diff) |
|---|
comment:2 by , 3 weeks ago
| Internal Changes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.



Fixed in [17912] and merged in [17913].