File: scanner-loader-context-managers-5d80d95dc3d33fe0.yaml

package info (click to toggle)
python-reno 4.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 776 kB
  • sloc: python: 5,263; makefile: 21; sh: 10
file content (31 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
fixes:
  - |
    Instances of ``reno.scanner.Scanner`` and ``reno.loader.Loader`` will now
    corectly close all open files related to the scanned Git repo when the
    ``close()`` method is called. Alternatively, these classes may be used as
    a context manager. Previously, Python would attempt to close these files
    itself, resulting in a ``ResourceWarning`` warning being emitted.
features:
  - |
    The ``reno.scanner.Scanner`` and ``reno.loader.Loader`` classes can now
    be used as context managers. For example::

        import reno.scannner

        with reno.scanner.Scanner(...) as scanner:
            pass

    This will ensure any open files pertaining to the scanned Git repo are
    correctly closed, avoiding ``ResourceWarning`` instances otherwise seen.

    A ``close()`` method is also provided for both, allowing use outside of
    context managers. For example::

        import reno.loader

        loader = reno.loader.Loader(...)
        try:
            pass
        finally:
            loader.close()