Page MenuHomePhabricator

test: fix constructor of msg_tx
ClosedPublic

Authored by PiRK on Thu, Nov 6, 17:04.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCdc73a3e11b56: test: fix constructor of msg_tx
Summary

In python, if the default value is a mutable object
its shared over all instances, so that one instance being changed
would affect others to be changed as well.
This was likely the source of various intermittent bugs in the
functional tests.

This is a backport of core#30552

Test Plan

ninja check-functional

Diff Detail

Event Timeline

PiRK requested review of this revision.Thu, Nov 6, 17:04

We fixed some of these issues with D7910 with some regex catching lists, dicts or set literals. But this is insufficient.

We might want to backport core#30553 for a more generic solution catching other type of mutable default args. This would add a new linter (ruff), but according to the doc it has drop-in parity with black and flake8, so maybe a net win in the end.

This revision is now accepted and ready to land.Thu, Nov 6, 20:16
This revision was automatically updated to reflect the committed changes.