Skip to content

Commit 94b8b40

Browse files
authored
removed _function_names and _event_names
ContractEvents and ContractFunctions have not used lists _event_names / _function_names. Each time a contract is created through the factory method, the _event_names list and the _function_names list are extended. Creating many contract's results in high memory usage.
1 parent 4c52f0d commit 94b8b40

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

web3/contract.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,11 @@ class ContractFunctions:
105105
"""Class containing contract function objects
106106
"""
107107

108-
_function_names = []
109-
110108
def __init__(self, abi, web3, address=None):
111109
if abi:
112110
self.abi = abi
113111
self._functions = filter_by_type('function', self.abi)
114112
for func in self._functions:
115-
self._function_names.append(func['name'])
116113
setattr(
117114
self,
118115
func['name'],
@@ -152,14 +149,11 @@ class ContractEvents:
152149
"""Class containing contract event objects
153150
"""
154151

155-
_event_names = []
156-
157152
def __init__(self, abi, web3, address=None):
158153
if abi:
159154
self.abi = abi
160155
self._events = filter_by_type('event', self.abi)
161156
for event in self._events:
162-
self._event_names.append(event['name'])
163157
setattr(
164158
self,
165159
event['name'],

0 commit comments

Comments
 (0)