| 1 | --- |
| 2 | fixes: |
| 3 | - | |
| 4 | Instances of ``reno.scanner.Scanner`` and ``reno.loader.Loader`` will now |
| 5 | corectly close all open files related to the scanned Git repo when the |
| 6 | ``close()`` method is called. Alternatively, these classes may be used as |
| 7 | a context manager. Previously, Python would attempt to close these files |
| 8 | itself, resulting in a ``ResourceWarning`` warning being emitted. |
| 9 | features: |
| 10 | - | |
| 11 | The ``reno.scanner.Scanner`` and ``reno.loader.Loader`` classes can now |
| 12 | be used as context managers. For example:: |
| 13 | |
| 14 | import reno.scannner |
| 15 | |
| 16 | with reno.scanner.Scanner(...) as scanner: |
| 17 | pass |
| 18 | |
| 19 | This will ensure any open files pertaining to the scanned Git repo are |
| 20 | correctly closed, avoiding ``ResourceWarning`` instances otherwise seen. |
| 21 | |
| 22 | A ``close()`` method is also provided for both, allowing use outside of |
| 23 | context managers. For example:: |
| 24 | |
| 25 | import reno.loader |
| 26 | |
| 27 | loader = reno.loader.Loader(...) |
| 28 | try: |
| 29 | pass |
| 30 | finally: |
| 31 | loader.close() |