Opened 13 months ago
Closed 13 months ago
#34973 closed New feature (wontfix)
Allow making unpickling warnings an error
Reported by: | stefan6419846 | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 4.2 |
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 |
Description
In #21430 (https://github.com/django/django/commit/42736ac), unpickling has been changed to log a warning for incompatible versions. While this raises awareness, this is not really practical if you have lots of deployments to consider.
We are using mostly automated deployments to quickly provide the latest changes to our customers. Whenever we update to a newer Django, we need to clear the whole cache. Automating this requires special handling, as running the cache invalidation on every deployment seems to be overkill for unrelated updates - thus some custom logic is required to only force an invalidation on Django package changes when necessary at the moment.
For this reason, I would like to propose an additional/changed solution which turns this into hard failures which can be handled by my application without having to invalidate the cache itself. This way, I am able to cleanly detect this and handle it appropriately.
Due to being a backwards-incompatible change, this might be changed by a new setting which defaults to the old behavior.
Thanks for the report, however you should be able to make these warnings errors using
warnings.filterwarnings()
. There is no need to change anything in Django itself.