| Age | Commit message (Collapse) | Author |
|
functools.cached_property.
Since Python 3.12, `functools.cached_property` no longer takes a lock
(https://github.com/python/cpython/issues/87634), which was the main
objection to using it instead of Django's own implementation.
`Prefetch(to_attr=...)` and the admindocs model detail page now accept
`functools.cached_property` as well as Django's own `cached_property`.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
|
|
Python 3.15 added the `parent_mode` argument to `os.makedirs()`, the
upstream fix for the issue that led Django to vendor its own
`makedirs()` in the fix for CVE-2026-25674. The vendored copy differed
from CPython only by an extra `chmod()` call that ignored the process
umask. Dropping that call allows using `os.makedirs()` directly on
Python 3.15+, and removing the vendored copy once Python 3.14 support
ends.
As a trade-off, directories created by `FileSystemStorage` when
`FILE_UPLOAD_DIRECTORY_PERMISSIONS` (or `directory_permissions_mode`) is
set, and by `FileBasedCache`, now have the requested permissions mode
combined with the process umask, and the set-group-ID bit and other
bits beyond the last 9 are no longer guaranteed to be set.
`FILE_UPLOAD_PERMISSIONS` is unaffected.
Thanks Shai Berger for the proposal and review, Ken Whitesell and
Carlton Gibson for the discussion, and Tim Schilling, Jacob Walls, and
Lily for reviews.
Refs #36664.
|
|
|
|
cached template fragments.
This algorithm used a delimiter, but because it didn't use a length,
argument values containing the delimiter could still cause collisions.
|
|
|
|
|
|
|
|
system object creation.
This fix introduces `safe_makedirs()` in the `os` utils as a safer
alternative to `os.makedirs()` that avoids umask-related race conditions
in multi-threaded environments.
This is a workaround for https://github.com/python/cpython/issues/86533
and the solution is based on the fix being proposed for CPython.
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Refs CVE-2020-24583 and #31921.
Thanks Tarek Nakkouch for the report, and Jake Howard, Jacob Walls, and
Shai Berger for reviews.
|
|
|
|
available.
Thanks Simon Charette, Sarah Boyce, and Jacob Walls for reviews.
|
|
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
|
|
Manually reformatted some long docstrings and comments that would be
damaged by the to-be-applied autofixer script, in cases where editorial
judgment seemed necessary for style or wording changes.
|
|
|
|
|
|
https://github.com/psf/black/releases/tag/25.1.0
|
|
datetime.UTC was added in Python 3.11.
|
|
|
|
https://github.com/psf/black/releases/tag/24.1.0
|
|
|
|
Black 23.1.0 is released which, as the first release of the year,
introduces the 2023 stable style. This incorporates most of last year's
preview style.
https://github.com/psf/black/releases/tag/23.1.0
|
|
|
|
|
|
Co-authored-by: Sin-Woo Bang <sinwoobang@gmail.com>
|
|
condition.
|
|
empty list.
|
|
|
|
Thanks Ben Picolo for the report.
|
|
|
|
Remaining test case ensures that uses of the alias are mapped
canonically by the migration writer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
md5 is not an approved algorithm in FIPS mode, and trying to instantiate
a hashlib.md5() will fail when the system is running in FIPS mode.
md5 is allowed when in a non-security context. There is a plan to add a
keyword parameter (usedforsecurity) to hashlib.md5() to annotate whether
or not the instance is being used in a security context.
In the case where it is not, the instantiation of md5 will be allowed.
See https://bugs.python.org/issue9216 for more details.
Some downstream python versions already support this parameter. To
support these versions, a new encapsulation of md5() has been added.
This encapsulation will pass through the usedforsecurity parameter in
the case where the parameter is supported, and strip it if it is not.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
|
|
Thanks Carlton Gibson, Chris Jerdonek, David Smith, Keryn Knight,
Mariusz Felisiak, and Nick Pope for reviews and mentoring this
Google Summer of Code 2021 project.
|
|
This also makes DummyCache async-compatible.
|
|
This helper function reduces the amount of duplicated code and makes it
easier to ensure that we always validate the keys.
|
|
The validate_key() function should be called after make_key() to ensure
that the validation is performed on the key that will actually be
stored in the cache.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
All cache operations should use make_key().
|
|
|
|
incr()/decr() in memcached backends.
Thanks Chris Jerdonek for the review.
|
|
|
|
Thanks Alexander Ebral for the report.
Regression in 98e05ccde440cc9b768952cc10bc8285f4924e1f.
|
|
- Replaced datetime.utcnow() with datetime.now().
- Replaced datetime.utcfromtimestamp() with datetime.fromtimestamp().
- Replaced datetime.utctimetuple() with datetime.timetuple().
- Replaced calendar.timegm() and datetime.utctimetuple() with datetime.timestamp().
|
|
closed cursor.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
Many of the cache operations make use of the default argument to the
.get() operation to determine whether the key was found in the cache.
The default value of the default argument is None, so this results in
these operations assuming that None is not stored in the cache when it
actually is. Adding a sentinel object solves this issue.
Unfortunately the unmaintained python-memcached library does not support
a default argument to .get(), so the previous behavior is preserved for
the deprecated MemcachedCache backend.
|
|
|