diff --git a/changelog/11282.breaking.rst b/changelog/11282.breaking.rst index 8d0bd1045..cee9788ef 100644 --- a/changelog/11282.breaking.rst +++ b/changelog/11282.breaking.rst @@ -1,11 +1,11 @@ -Sanitized the default value for configuration options. +Sanitized the handling of the ``default`` parameter when defining configuration options. -Previously if a default was not supplied during :meth:`parser.addini ` and the option value was not defined, then a call to :func:`config.getini ` to get the config option value either returned an *empty list* or an *empty string* depending on whether a type is supplied or not respectively, which is clearly incorrect. Also, ``None`` was not honored as ``default`` even if ``default=None`` was used explicitly while defining the option. +Previously if ``default`` was not supplied for :meth:`parser.addini ` and the configuration option value was not defined in a test session, then calls to :func:`config.getini ` returned an *empty list* or an *empty string* depending on whether ``type`` was supplied or not respectively, which is clearly incorrect. Also, ``None`` was not honored even if ``default=None`` was used explicitly while defining the option. -Now the behavior is as follows: +Now the behavior of :meth:`parser.addini ` is as follows: -* If a default value is NOT set but the type for the option is provided, then a type specific default will be returned. For example ``type=bool`` will return ``False``, ``type=str`` will return ``""``, etc. -* If a default value of ``None`` is supplied, then ``None`` will be returned, regardless of the ``type``. +* If ``default`` is NOT passed but ``type`` is provided, then a type-specific default will be returned. For example ``type=bool`` will return ``False``, ``type=str`` will return ``""``, etc. +* If ``default=None`` is passed and the option is not defined in a test session, then ``None`` will be returned, regardless of the ``type``. * If neither ``default`` nor ``type`` are provided, assume ``type=str`` and return ``""`` as default (this is as per previous behavior). The team decided to not introduce a deprecation period for this change, as doing so would be complicated both in terms of communicating this to the community as well as implementing it, and also because the team believes this change should not break existing plugins except in rare cases.