ethereum / eth-abi

Ethereum ABI utilities for python
MIT License
248 stars 269 forks source link

🚨 fix linting warning (rule B019) #230

Closed DavidRomanovizc closed 8 months ago

DavidRomanovizc commented 9 months ago

What was wrong?

The codebase currently use the lru_cache decorator in the NodeVisitor and ABIRegistry classes over methods. The flake8-bugbear linter reported a B019 warning, indicating potential memory leaks in class methods. The lru_cache decorator retain instance references, impeding garbage collection and potentially leading to memory-related issues.

Related to Issue #218 Closes #218

How was it fixed?

We don't have to replace lru_cache with something else for solve linter warning. This problem can be solved in the following way: we stopped using decorators directly over methods. Instead we apply the decorator function when initializing a class instance.

Todo:

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

DavidRomanovizc commented 9 months ago

@pacrob could you review my PR, please? If you're not busy with something else, I'd appreciate your feedback

pacrob commented 8 months ago

Looks great, @DavidRomanovizc ! Thanks for your help, I learned something today :)