@@ -145,8 +145,8 @@ def new_label(self) -> str:
145145 self .context .temp_counter += 1
146146 return '__LL%d' % self .context .temp_counter
147147
148- def get_module_lib_prefix (self , module_name : str ) -> str :
149- """Get the library prefix for a module.
148+ def get_module_group_prefix (self , module_name : str ) -> str :
149+ """Get the group prefix for a module (relative to the current group) .
150150
151151 The prefix should be prepended to the object name whenever
152152 accessing an object from this module.
@@ -155,6 +155,13 @@ def get_module_lib_prefix(self, module_name: str) -> str:
155155 no prefix. But if it lives in a different group (and hence a separate
156156 extension module), we need to access objects from it indirectly via an
157157 export table.
158+
159+ For example, for code in group `a` to call a function `bar` in group `b`,
160+ it would need to do `exports_b.CPyDef_bar(...)`, while code that is
161+ also in group `b` can simply do `CPyDef_bar(...)`.
162+
163+ Thus the prefix for a module in group `b` is 'exports_b.' if the current
164+ group is *not* b and just '' if it is.
158165 """
159166 groups = self .context .group_map
160167 target_group_name = groups .get (module_name )
@@ -164,10 +171,10 @@ def get_module_lib_prefix(self, module_name: str) -> str:
164171 else :
165172 return ''
166173
167- def get_lib_prefix (self , obj : Union [ClassIR , FuncDecl ]) -> str :
168- """Get the library prefix for an object."""
174+ def get_group_prefix (self , obj : Union [ClassIR , FuncDecl ]) -> str :
175+ """Get the group prefix for an object."""
169176 # See docs above
170- return self .get_module_lib_prefix (obj .module_name )
177+ return self .get_module_group_prefix (obj .module_name )
171178
172179 def static_name (self , id : str , module : Optional [str ], prefix : str = STATIC_PREFIX ) -> str :
173180 """Create name of a C static variable.
@@ -179,7 +186,7 @@ def static_name(self, id: str, module: Optional[str], prefix: str = STATIC_PREFI
179186 overlap with other calls to this method within a compilation
180187 group.
181188 """
182- lib_prefix = '' if not module else self .get_module_lib_prefix (module )
189+ lib_prefix = '' if not module else self .get_module_group_prefix (module )
183190 # If we are accessing static via the export table, we need to dereference
184191 # the pointer also.
185192 star_maybe = '*' if lib_prefix else ''
0 commit comments