Opened 3 years ago

Last modified 3 years ago

#32705 closed Cleanup/optimization

Database cache.delete uses cursor after it is closed — at Initial Version

Reported by: ecogels Owned by: nobody
Component: Core (Cache system) Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The return bool(cursor.rowcount) is outside of the with block, so the cursor will have been closed at that point.

From the DB API 2.0 spec: "The cursor will be unusable from this point forward" https://www.python.org/dev/peps/pep-0249/#Cursor.close

As the main backend drivers don't mind it I suppose that is is open to interpretation.

Here is a basic PR https://github.com/django/django/compare/main...ecogels:fix-dbcache-delete-1

Change History (0)

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