Remove LicenseInfo.private_data and help extensibility.
Review Request #14496 — Created June 29, 2025 and updated — Latest diff uploaded
Originally when the new licensing code was added, the intent was to back
license representations by aLicenseInfo
and to allow license
providers to extend that by plugging state into aprivate_data
member.Since the original design, support for
LicenseInfo
subclasses was
added, largely removing the need forprivate_data
. In practice,
though, theLicenseInfo
dataclass could not be extended with new
required arguments due to the way that the dataclass was registered.
By default, dataclasses register fields as positional arguments instead
of keyword-only arguments, and this means that any field registered
after the last field with a default must itself have a default, even in
subclasses. This isn't ideal for this purpose.We can't use
kw_only=True
, since that's only available on Python 3.10
and higher, and there's no getting around the internal logic that
impacts subclasses. Plus, dataclasses are slow and truly necessary, just
a convenience.So to help facilitate License Provider backends with custom state, and
avoid the dataclass issues, this has been converted to a standard class.
This will also make it easier for subclasses to override it in a
consistent way without having to tie into the dataclass-specific
post-construction hooks.
Unit tests pass.
Successfully created and used subclasses of
LicenseInfo
with new
required fields.
reviewboard/licensing/license.py |
---|