Opened 4 years ago

Closed 4 years ago

#16447 closed Bug (fixed)

settings_changed signal uses strings for sender

Reported by: Alex Owned by: nobody
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Since internally the sender is represented by the id() this is not valid, because there's no guarntee 2 strings of the same value have the same id(). This reproduces easily with PyPy:

alex@alex-gaynor-laptop:~/projects/django$ PYTHONPATH=`pwd` ~/projects/pypy/pypy-c tests/ --settings=test_sqlite settings_tests --failfast
Creating test database for alias 'default'...
Creating test database for alias 'other'...
FAIL: test_signal_callback_context_manager (regressiontests.settings_tests.tests.SettingsTests)
Traceback (most recent call last):
  File "/home/alex/projects/django/tests/regressiontests/settings_tests/", line 80, in test_signal_callback_context_manager
    self.assertEqual(testvalue, 'override')
AssertionError: None != 'override'

Ran 12 tests in 0.004s

FAILED (failures=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...

but it would also be possible to reproduce with CPython.

Change History (1)

comment:1 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

In [16530]:

Fixed #16447 -- Stopped using the setting name as the sender parameter for the setting_changed signal. Thanks, Alex Gaynor.

Note: See TracTickets for help on using tickets.
Back to Top