#32705: Database cache.delete uses cursor after it is closed
------------------------------------------------+------------------------
               Reporter:  ecogels               |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  Core (Cache system)   |        Version:  3.2
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  1
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  1
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 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

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32705>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.468cb81e2d92ce4190775e8f0752386f%40djangoproject.com.

Reply via email to