Skip to content

Commit

Permalink
docs(newsfragments): add a newsfragment for falconry#2293
Browse files Browse the repository at this point in the history
  • Loading branch information
vytas7 committed Sep 6, 2024
1 parent ea69b18 commit 16c8d5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/_newsfragments/2293.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Customizing
:attr:`MultipartParseOptions.media_handlers
<falcon.media.multipart.MultipartParseOptions.media_handlers>` could previously
lead to unintentionally modifying a shared class variable.
This has been fixed, and the
:attr:`~falcon.media.multipart.MultipartParseOptions.media_handlers` attribute
is now initialized to a fresh copy of handlers for every instance of
:class:`~falcon.media.multipart.MultipartParseOptions`. To that end, a proper
:meth:`~falcon.media.Handlers.copy` method has been implemented for the media
:class:`~falcon.media.Handlers` class.
2 changes: 1 addition & 1 deletion tests/test_media_multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,6 @@ def test_multipart_parse_options_default_handlers_unique():

parse_options_one.media_handlers.pop(falcon.MEDIA_JSON)

assert id(parse_options_one.media_handlers) != id(parse_options_two.media_handlers)
assert parse_options_one.media_handlers is not parse_options_two.media_handlers
assert len(parse_options_one.media_handlers) == 1
assert len(parse_options_two.media_handlers) >= 2

0 comments on commit 16c8d5b

Please sign in to comment.