Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: io: don't use mutable object as default value #2086

Merged

Conversation

maass-hamburg
Copy link
Contributor

don't use mutable object (here: ClockSignal()) as default value, because they will be the same object.
Leeds to problems, when for example two SDRInput are used in two different Modules and one of them is used with a ClockDomainsRenamer(), then both are changed.

more infos: https://florimond.dev/en/posts/2018/08/python-mutable-defaults-are-the-source-of-all-evil

don't use mutable object (here: ClockSignal()) as default value,
beacuse they will be the same object.
Leeds to problems, when for example two `SDRInput`
are used in two different Modules and one of them is
used with a `ClockDomainsRenamer()`, then both are changed.

Signed-off-by: Fin Maaß <[email protected]>
@enjoy-digital enjoy-digital merged commit 644ef7e into enjoy-digital:master Oct 1, 2024
1 check passed
@enjoy-digital
Copy link
Owner

Thanks @maass-hamburg!

@maass-hamburg maass-hamburg deleted the build_io_clocksignal branch October 1, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants