When initially reading a config.py and trying to validate QtFont values,
Font.default_size is still set to None. This is because it needs to be
initialized later in _late_init, as doing so requires a QApplication.
This results in the following error while running config.py:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/qutebrowser/config/configfiles.py", line 731, in read_config_py
exec(code, module.__dict__)
File ".../.config/qutebrowser/config.py", line 52, in <module>
c.fonts.debug_console = 'default_size default_family'
File "/usr/lib/python3.8/site-packages/qutebrowser/config/config.py", line 611, in __setattr__
self._config.set_obj(name, value, pattern=self._pattern)
File "/usr/lib/python3.8/site-packages/qutebrowser/config/config.py", line 457, in set_obj
self._set_value(opt, value, pattern=pattern,
File "/usr/lib/python3.8/site-packages/qutebrowser/config/config.py", line 317, in _set_value
opt.typ.to_py(value) # for validation
File "/usr/lib/python3.8/site-packages/qutebrowser/config/configtypes.py", line 1336, in to_py
if size.lower().endswith('pt'):
AttributeError: 'NoneType' object has no attribute 'lower'
Similarly to what's done for configtypes.Font, assume that a None size is fine.
Note that the default_size setting already gets validated via a separate regex
anyways.
Our tests didn't catch this because the init_patch patching already set
default_size to a non-None value. While this makes sense for the rest of the
tests, in test_configinit we really should have the real default value.
Fixes#5223
(cherry picked from commit d68f484b6d003e5708fe390a921175c6c7777641)