@@ -130,33 +130,35 @@ def __init__(self, module, code_type, jit_options=None, *, symbol_mapping=None):
130
130
def _lazy_load_module (self , * args , ** kwargs ):
131
131
if self ._handle is not None :
132
132
return
133
- if isinstance (self ._module , str ):
133
+ jit_options = self ._jit_options
134
+ module = self ._module
135
+ if isinstance (module , str ):
134
136
# TODO: this option is only taken by the new library APIs, but we have
135
137
# a bug that we can't easily support it just yet (NVIDIA/cuda-python#73).
136
- if self . _jit_options is not None :
138
+ if jit_options is not None :
137
139
raise ValueError
138
- self ._handle = handle_return (self ._loader ["file" ](self . _module ))
140
+ self ._handle = handle_return (self ._loader ["file" ](module ))
139
141
else :
140
- assert isinstance (self . _module , bytes )
141
- if self . _jit_options is None :
142
- self . _jit_options = {}
142
+ assert isinstance (module , bytes )
143
+ if jit_options is None :
144
+ jit_options = {}
143
145
if self ._backend_version == "new" :
144
146
args = (
145
- self . _module ,
146
- list (self . _jit_options .keys ()),
147
- list (self . _jit_options .values ()),
148
- len (self . _jit_options ),
147
+ module ,
148
+ list (jit_options .keys ()),
149
+ list (jit_options .values ()),
150
+ len (jit_options ),
149
151
# TODO: support library options
150
152
[],
151
153
[],
152
154
0 ,
153
155
)
154
156
else : # "old" backend
155
157
args = (
156
- self . _module ,
157
- len (self . _jit_options ),
158
- list (self . _jit_options .keys ()),
159
- list (self . _jit_options .values ()),
158
+ module ,
159
+ len (jit_options ),
160
+ list (jit_options .keys ()),
161
+ list (jit_options .values ()),
160
162
)
161
163
self ._handle = handle_return (self ._loader ["data" ](* args ))
162
164
0 commit comments