Commit fca87390 authored by Robert Bradshaw's avatar Robert Bradshaw

Polish cimport from pyx.

parent 58382606
...@@ -2115,7 +2115,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -2115,7 +2115,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# Generate code to create PyCFunction wrappers for exported C functions. # Generate code to create PyCFunction wrappers for exported C functions.
entries = [] entries = []
for entry in env.var_entries: for entry in env.var_entries:
if entry.api or entry.defined_in_pxd or Options.cimport_from_pyx: if (entry.api
or entry.defined_in_pxd
or (Options.cimport_from_pyx and not entry.visibility == 'extern')):
entries.append(entry) entries.append(entry)
if entries: if entries:
env.use_utility_code(voidptr_export_utility_code) env.use_utility_code(voidptr_export_utility_code)
...@@ -2129,7 +2131,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -2129,7 +2131,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# Generate code to create PyCFunction wrappers for exported C functions. # Generate code to create PyCFunction wrappers for exported C functions.
entries = [] entries = []
for entry in env.cfunc_entries: for entry in env.cfunc_entries:
if entry.api or entry.defined_in_pxd or Options.cimport_from_pyx: if (entry.api
or entry.defined_in_pxd
or (Options.cimport_from_pyx and not entry.visibility == 'extern')):
entries.append(entry) entries.append(entry)
if entries: if entries:
env.use_utility_code(function_export_utility_code) env.use_utility_code(function_export_utility_code)
......
...@@ -1078,6 +1078,8 @@ class ModuleScope(Scope): ...@@ -1078,6 +1078,8 @@ class ModuleScope(Scope):
self.var_entries.append(entry) self.var_entries.append(entry)
else: else:
entry.is_pyglobal = 1 entry.is_pyglobal = 1
if Options.cimport_from_pyx:
entry.used = 1
return entry return entry
def declare_cfunction(self, name, type, pos, def declare_cfunction(self, name, type, pos,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment