Comment 2 for bug 1954321

Revision history for this message
Cyril Roelandt (cyril-roelandt) wrote :

Thanks for your report. There are actually two issues here: one with Python3.9 and one with our tests.

$ cat cfg
[^[0-9]]
create = fake-role
rade = fake-role
update = fake-role
delete = fake-role

$ cat cfg.py
import configparser
CONF = configparser.ConfigParser()
CONF.read('/tmp/cfg')
print(CONF.sections()[0])

$ python3.9 cfg.py
^[0-9
$ python3.10 cfg.py
^[0-9]

There was a bug in 3.9 preventing the name of the section from being properly read, and it was fixed in 3.10 (https://github.com/python/cpython/commit/1cc6769e4146951d47528a97e56ba1e8e9ee7fc1).

In our tests, with Python3.9:
- _load_rules calls self._compile_rule('^[0-9'))
- in _compile_rule, re.compile('^[0-9') fails, which raises exception.InvalidPropertyProtectionConfiguration and allows the test to pass

With Python3.10, _compile_rule does not fail, allowing to move further in _load_rules and hit CONFIGK.get, which fails.