Opened 4 years ago
Closed 4 years ago
#32108 closed Cleanup/optimization (fixed)
Allowing null values while registering function on transaction on_commit
Description ¶
So if I were to try this command:-
transaction.on_commit(None)
and run any sample tests which has simple django db post_save signal in the flow and it has functions which run on transaction commit, the code would crash with error
TypeError: 'NoneType' object is not callable
.
So how about if we do not allow it to register as none beforehand or allow it to exit gracefully?
Change History (5)
comment:1 by , 4 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Bug → Cleanup/optimization |
comment:2 by , 4 years ago
Easy pickings: | set |
---|
comment:4 by , 4 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
I guess we could add a
callable
guard intransaction.on_commit
to make tracing easier like we did inSignal.connect
https://github.com/django/django/blob/b26ec77deb7c5052163ef8514ec7db70c0a5ea2a/django/dispatch/dispatcher.py#L90