Changes between Initial Version and Version 1 of Ticket #32821
- Timestamp:
- Jun 6, 2021, 12:00:48 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #32821 – Description
initial v1 1 I noticed that Django doesn't use a `with` statement when it uses `os.scandir()`, which is what the [https://docs.python.org/3/library/os.html#os.scandir.close Python docs advise as of 3.6]. Here is [https://github.com/django/django/blob/ecf8af79355c8daa67722bd0de946b351f7f613d/django/core/files/storage.py#L324-L328 one example in the code]. There appear to be 7 uses of `os.scandir()` in all, with 5 in test code.1 I noticed that Django doesn't use a `with` statement (or call `close()`) when it uses `os.scandir()`, which is what the [https://docs.python.org/3/library/os.html#os.scandir.close Python docs advise as of 3.6]. Here is [https://github.com/django/django/blob/ecf8af79355c8daa67722bd0de946b351f7f613d/django/core/files/storage.py#L324-L328 one example in the code]. There appear to be 7 uses of `os.scandir()` in all, with 5 in test code. 2 2 3 3 Usage with the `with` statement looks like this: