#31233: Improve handling of database connection and cursor resources
-------------------------------------+-------------------------------------
     Reporter:  Jon Dufresne         |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 Exceptions within `__del__` are effectively turned into stdout messages
 and not raised but elevating them to errors make messages way more useful
 and explicit about their origin

 e.g.

 {{{#!python
 warnings.filterwarnings('error', 'unclosed', ResourceWarning)
 }}}

 Revealed a ton of other wise silenced messages of the following form when
 running the suite of a large Django project

 {{{
 ResourceWarning: unclosed file <_io.TextIOWrapper name='path-to-file.json'
 mode='r' encoding='UTF-8'>
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31233#comment:4>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.b882bfa1bc0d32775ea3116e106e8242%40djangoproject.com.

Reply via email to