The File orig and ContentFile thumb_file variables created in Avatar.create_thumbnail do not appear to be closed before the method returns: https://github.com/jazzband/django-avatar/blob/main/avatar/models.py#L142
Django: 4.1.13
django-avatar: 8.0.0
Python 3.10
While upgrading Django, I noted the following error while running pytest with -Wa flags enabled & PYTHONWARNINGS=always in my env:
/usr/local/lib/python3.10/dist-packages/avatar/models.py:201: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/tmphkurztys/img/avatar/1/29711aa648bad2dca40e2463dc8761cb.gif'>
instance.create_thumbnail(size, size)
Enable tracemalloc to get traceback where the object was allocated.
See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
Hopping into a debugger, I can see that by the bottom of the function both have a closed property of False:


The
FileorigandContentFilethumb_filevariables created inAvatar.create_thumbnaildo not appear to be closed before the method returns: https://github.com/jazzband/django-avatar/blob/main/avatar/models.py#L142Django:
4.1.13django-avatar:
8.0.0Python 3.10
While upgrading Django, I noted the following error while running pytest with
-Waflags enabled &PYTHONWARNINGS=alwaysin my env:Hopping into a debugger, I can see that by the bottom of the function both have a


closedproperty ofFalse: