#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                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  1                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Description changed by ecogels:

Old 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

New 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.


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

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32705#comment:2>
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/065.f48b9bd5cfa6e3b28e08903054d64406%40djangoproject.com.

Reply via email to