Opened 3 years ago

Last modified 3 years ago

#32705 closed Cleanup/optimization

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

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 (last modified by ecogels)

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.

PR https://github.com/django/django/pull/14341

Change History (2)

comment:1 by Simon Charette, 3 years ago

Triage Stage: UnreviewedAccepted

comment:2 by ecogels, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top