Page MenuHomePhabricator

fix a potential regex search error in cdefs.py
ClosedPublic

Authored by PiRK on Feb 24 2021, 15:52.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC9cd19beca9d5: fix a potential regex search error in cdefs.py
Summary

Running mypy on the functional tests folder raises this error:

test/functional/test_framework/cdefs.py:65: error: Item "None" of "Optional[Match[str]]" has no attribute "group"

This is caused by the fact that re.match may return None if the regex
doesn't match. Adding an explicit test for match is None catches such
situations and allows to print a more useful error message.

Test Plan

ninja check-functional

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable