Thread View: linux.debian.bugs.dist
1 messages
1 total messages
Started by Nico Della Torre
Tue, 13 Oct 2026 10:10
Bug#1150759: python3-pytoolconfig: values read from setup.cfg / INI files are always strings
Author: Nico Della Torre
Date: Tue, 13 Oct 2026 10:10
Date: Tue, 13 Oct 2026 10:10
59 lines
3281 bytes
3281 bytes
Package: python3-pytoolconfig
Version: 1.3.1-5
Severity: normal
Tags: upstream
`IniConfig` returns the raw `configparser` values, and
`_dict_to_dataclass()` assigns them without conversion, so non-string
fields get strings. This is especially problematic for booleans, since
`"false"` is truthy.
setup.cfg:
[t]
flag = false
n = 3
test.py:
from dataclasses import dataclass
from pathlib import Path
from pytoolconfig import PyToolConfig
from pytoolconfig.sources import SetupConfig
@dataclass
class Config:
flag: bool = True
n: int = 0
cwd = Path(".")
config = PyToolConfig("t", cwd, Config, custom_sources=[SetupConfig(cwd, "t")]).parse()
print(repr(config.flag), repr(config.n))
Actual: `'false' '3'`
Expected: `False 3`
Since INI has no types, the values need to be converted according to the
field type, e.g. `ConfigParser.getboolean()` semantics for `bool`, and
`int()` / `float()` for numeric fields.
Reproduced with python3-pytoolconfig 1.3.1-5 (code unchanged in 1.3.1-6)
on Python 3.13 and 3.14, and with upstream main (bee6db4).
This is an upstream bug, it will be forwarded.
-- System Information:
Debian Release: forky/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 7.2.9+deb14-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8), LANGUAGE=it
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads