1
0
mirror of https://github.com/django/django.git synced 2025-05-17 04:16:27 +00:00

16 Commits

Author SHA1 Message Date
Simon Charette
760121dcb1 Fixed #35801 -- Prevented collision of senders with non-overlapping lifetimes.
As documented, the id() function can return the same value for distinct
objects with non-overlapping lifetimes which can result in signals being
sent to the wrong receivers if two distinct senders happen to have a
colliding id() value.

Since reproduction of the issue requires memory constrained
circumstances where the same exact id() is reused for two senders of the
same signal the test opt to simulate the collision by systematically
making the same id for Sender instances.

Note that we explicitly avoid keeping a strong reference to senders that
cannot be weakly referenced as that would unexpectedly prevent them from
being garbage collected. This means that id(sender) collisions could
still occur for such objects but Django itself doesn't make use of them.

Thanks Sjoerd Job Postmus for the reduced test case and Mariusz for the
review.

Co-authored-by: And Clover <and@doxdesk.com>
2025-04-23 13:09:46 +01:00
Nick Pope
fb9216382a Refs #34986 -- Moved garbage_collect() helper to django.test.utils. 2023-12-06 09:26:11 +01:00
Nick Pope
9baaf89eed Refs #34986 -- Added django.utils.version.PYPY. 2023-11-27 10:37:29 +01:00
django-bot
9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Mateo Radman
8a7ac78b70 Refs #32508 -- Raised ImproperlyConfigured/TypeError instead of using "assert" in various code. 2021-06-25 06:55:47 +02:00
Ayush Bansal
b960e4ed72 Fixed #32261 -- Added error logging to Signal.send_robust(). 2020-12-15 11:00:26 +01:00
Jon Dufresne
769cee5252 Fixed #31327 -- Deprecated providing_args argument for Signal. 2020-03-05 09:38:52 +01:00
Nick Pope
a2d894b2e4 Refs #28954 -- Removed remaining Jython-specific code from dispatch tests.
Missed in 23b21db31bfcf2a065d485617412cca43a311a4c.
2019-12-19 16:42:12 +01:00
Simon Charette
cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Adam Chainz
c70ffeeb8b Completed django.dispatch test coverage. 2016-11-22 09:07:42 -05:00
Ramin Farajpour Cami
967be82443 Fixed E305 flake8 warnings. 2016-11-14 12:30:46 -05:00
Alasdair Nicol
d91321e8be Used assertIsInstance in tests. 2015-04-27 08:40:36 -04:00
Tim Graham
0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Andriy Sokolovskiy
23f1a8dad2 Added return value to Signal.disconnect(). 2015-01-02 12:00:41 -05:00
Tim Graham
937fab030d Renamed an assertion in the dispatch tests. 2015-01-02 11:29:06 -05:00
Tim Graham
136a3ffe21 Removed unnecessary directory in dispatch tests. 2014-07-07 19:21:47 -04:00