diff --git a/ca/django_ca/management/base.py b/ca/django_ca/management/base.py index 067be5782..4959e86b1 100644 --- a/ca/django_ca/management/base.py +++ b/ca/django_ca/management/base.py @@ -84,6 +84,16 @@ class BinaryOutputWrapper(OutputWrapper): def __init__(self, out: typing.BinaryIO, ending: bytes = b"\n") -> None: super().__init__(out, ending=ending) # type: ignore[arg-type] + def flush(self) -> None: + """Overwritten from base class so we don't try to flush when the stream is already closed. + + Starting with Python 3.13, we see some untraceable teardown code call flush() despite the stream + already being closed. + """ + if self._out.closed is True: # pragma: only py>=3.13 + return + super().flush() + def write( # type: ignore[override] self, msg: Union[str, bytes] = b"", diff --git a/ca/django_ca/pydantic/type_aliases.py b/ca/django_ca/pydantic/type_aliases.py index 3e21a22fb..dac6fb018 100644 --- a/ca/django_ca/pydantic/type_aliases.py +++ b/ca/django_ca/pydantic/type_aliases.py @@ -143,6 +143,9 @@ def str_loader(value: str) -> T: NonEmptyOrderedSetTypeVar = TypeVar("NonEmptyOrderedSetTypeVar", bound=list[Any]) +#: A string that will convert :py:class:`~cg:cryptography.x509.ObjectIdentifier` objects. +#: +#: This type alias will also validate the x509 dotted string format. OIDType = Annotated[str, BeforeValidator(oid_parser), AfterValidator(oid_validator)] UniqueTupleTypeVar = TypeVar("UniqueTupleTypeVar", bound=tuple[Hashable, ...]) diff --git a/ca/django_ca/pydantic/validators.py b/ca/django_ca/pydantic/validators.py index 8b3a65832..a73a140e1 100644 --- a/ca/django_ca/pydantic/validators.py +++ b/ca/django_ca/pydantic/validators.py @@ -214,9 +214,9 @@ def serial_validator(value: str) -> str: def timedelta_as_number_parser(unit: Literal["seconds", "hours", "days"] = "seconds") -> Callable[[Any], Any]: - """Validator for timedeltas. + """Validator for ``timedelta``. - .. WARNING:: This validator differs in that it has to be called with a unit for timedeltas. + .. WARNING:: This validator differs in that it has to be called with a unit for ``timedeltas``. """ def validator(value: Any) -> Any: diff --git a/docs/source/conf.py b/docs/source/conf.py index 98c8a1984..ab561e012 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -468,6 +468,11 @@ "basename": os.path.basename, } +# Warnings +suppress_warnings = [ + "config.cache", # jinja_filters has unpickable objects +] + qualname_overrides = { "_io.BytesIO": "python:io.BytesIO", "_io.StringIO": "python:io.StringIO", @@ -500,7 +505,10 @@ # Ignore (not so important) classes where the documented name does not match the documented name. nitpick_ignore = [ ("py:class", "NoneType"), + ("py:class", "lambda"), + ("py:class", "locals>.