On Wednesday 08 January 2014 20:28:08 Michael Manfre wrote:
> >          else:
> > -            cursor.execute(sql, params)
> > +            # Get the cursor
> > +            with self.connection.cursor() as cursor:
> > +                cursor.execute(sql, params)
> 
> The ``with`` block explicitly closes the cursor, instead of leaving it to
> the driver and GC to deal with eventually.
> 
Objects that fall immediately out of scope are destroyed immediately (at least 
on CPython; I think also on PyPy).

connection.cursor().execute(...) is all over the codebase; it allows any 
backend which can save by re-using the cursor object to do so.

> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/django/django/pull/2143/files#r8733718