Skip to content

_getini_ini: "string" type returns list silently instead of raising TypeError #14808

Description

@EternalRights

Was comparing _getini_toml and _getini_ini after the addini type expression changes and noticed an inconsistency.

_getini_toml checks isinstance(value, str) for "string":

elif type == "string":
    if not isinstance(value, str):
        raise TypeError(...)
    return value

_getini_ini just returns the value as-is:

elif type == "string":
    return value

In [tool.pytest.ini_options], make_scalar keeps TOML arrays as lists instead of converting to str. So a TOML array for a type="string"
option makes _getini_ini return a list -- _getini_toml would raise.

"int" and "float" in _getini_ini already have the isinstance guard.
"string" is the only scalar type missing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions