Commit 16005a3d authored by Nikita Nemkin's avatar Nikita Nemkin

In cimport_from_pyx mode don't treat "cdef extern from" variables as being...

In cimport_from_pyx mode don't treat "cdef extern from" variables as being defined, preventing erroneous cross-module cimport.
parent 34e5a65a
...@@ -275,7 +275,8 @@ def create_pyx_as_pxd_pipeline(context, result): ...@@ -275,7 +275,8 @@ def create_pyx_as_pxd_pipeline(context, result):
break break
def fake_pxd(root): def fake_pxd(root):
for entry in root.scope.entries.values(): for entry in root.scope.entries.values():
entry.defined_in_pxd = 1 if not entry.in_cinclude:
entry.defined_in_pxd = 1
return StatListNode(root.pos, stats=[]), root.scope return StatListNode(root.pos, stats=[]), root.scope
pipeline.append(fake_pxd) pipeline.append(fake_pxd)
return pipeline return pipeline
......
...@@ -15,12 +15,13 @@ setup( ...@@ -15,12 +15,13 @@ setup(
######## a.pyx ######## ######## a.pyx ########
from b cimport Bclass, Bfunc, Bstruct, Benum, Benum_value, Btypedef from b cimport Bclass, Bfunc, Bstruct, Benum, Benum_value, Btypedef, Py_EQ, Py_NE
cdef Bclass b = Bclass(5) cdef Bclass b = Bclass(5)
assert Bfunc(&b.value) == b.value assert Bfunc(&b.value) == b.value
assert b.asStruct().value == b.value assert b.asStruct().value == b.value
cdef Btypedef b_type = &b.value cdef Btypedef b_type = &b.value
cdef Benum b_enum = Benum_value cdef Benum b_enum = Benum_value
cdef int tmp = Py_EQ
#from c cimport ClassC #from c cimport ClassC
#cdef ClassC c = ClassC() #cdef ClassC c = ClassC()
...@@ -28,6 +29,8 @@ cdef Benum b_enum = Benum_value ...@@ -28,6 +29,8 @@ cdef Benum b_enum = Benum_value
######## b.pyx ######## ######## b.pyx ########
from cpython.object cimport Py_EQ, Py_NE
cdef enum Benum: cdef enum Benum:
Benum_value Benum_value
......
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