Skip to content

Instantly share code, notes, and snippets.

@alendit
Last active August 29, 2015 14:04
Show Gist options
  • Save alendit/89b9c5a2cd28204e2a89 to your computer and use it in GitHub Desktop.
Save alendit/89b9c5a2cd28204e2a89 to your computer and use it in GitHub Desktop.
xdress compilation error (bug #259)
Error compiling Cython file:
------------------------------------------------------------
...
if isinstance(new_set, _SetUInt):
self.set_ptr = (<_SetUInt> new_set).set_ptr
elif isinstance(new_set, np.generic) and np.PyArray_DescrFromScalar(new_set).type_num == np.NPY_UINT32:
# scalars are copies, sadly not views, so we need to re-copy
if self.set_ptr == NULL:
self.set_ptr = new cpp_set[xdress_extra_types.uint32]()
^
------------------------------------------------------------
stlcontainers.pyx:95:35: Operation only allowed in c++
Error compiling Cython file:
------------------------------------------------------------
...
np.PyArray_ScalarAsCtype(new_set, &set_ptr)
self.set_ptr[0] = set_ptr[0]
elif hasattr(new_set, '__iter__') or \
(hasattr(new_set, '__len__') and
hasattr(new_set, '__getitem__')):
self.set_ptr = new cpp_set[xdress_extra_types.uint32]()
^
------------------------------------------------------------
stlcontainers.pyx:101:31: Operation only allowed in c++
Error compiling Cython file:
------------------------------------------------------------
...
for value in new_set:
s = <xdress_extra_types.uint32> long(value)
self.set_ptr.insert(s)
elif bool(new_set):
self.set_ptr = new cpp_set[xdress_extra_types.uint32]()
^
------------------------------------------------------------
stlcontainers.pyx:107:31: Operation only allowed in c++
Error compiling Cython file:
------------------------------------------------------------
...
# Store free_set
self._free_set = free_set
def __dealloc__(self):
if self._free_set:
del self.set_ptr
^
------------------------------------------------------------
stlcontainers.pyx:114:12: Operation only allowed in c++
Error compiling Cython file:
------------------------------------------------------------
...
if isinstance(new_map, _MapIntDouble):
self.map_ptr = (<_MapIntDouble> new_map).map_ptr
elif isinstance(new_map, np.generic) and np.PyArray_DescrFromScalar(new_map).type_num == np.NPY_OBJECT:
# scalars are copies, sadly not views, so we need to re-copy
if self.map_ptr == NULL:
self.map_ptr = new cpp_map[int, double]()
^
------------------------------------------------------------
stlcontainers.pyx:223:35: Operation only allowed in c++
Error compiling Cython file:
------------------------------------------------------------
...
if self.map_ptr == NULL:
self.map_ptr = new cpp_map[int, double]()
np.PyArray_ScalarAsCtype(new_map, &map_ptr)
self.map_ptr[0] = map_ptr[0]
elif hasattr(new_map, 'items'):
self.map_ptr = new cpp_map[int, double]()
^
------------------------------------------------------------
stlcontainers.pyx:227:31: Operation only allowed in c++
Error compiling Cython file:
------------------------------------------------------------
...
item = pair[int, double](<int> key, <double> value)
self.map_ptr.insert(item)
elif hasattr(new_map, '__len__'):
self.map_ptr = new cpp_map[int, double]()
^
------------------------------------------------------------
stlcontainers.pyx:234:31: Operation only allowed in c++
Error compiling Cython file:
------------------------------------------------------------
...
item = pair[int, double](<int> key, <double> value)
self.map_ptr.insert(item)
elif bool(new_map):
self.map_ptr = new cpp_map[int, double]()
^
------------------------------------------------------------
stlcontainers.pyx:241:31: Operation only allowed in c++
Error compiling Cython file:
------------------------------------------------------------
...
# Store free_map
self._free_map = free_map
def __dealloc__(self):
if self._free_map:
del self.map_ptr
^
------------------------------------------------------------
stlcontainers.pyx:248:12: Operation only allowed in c++
missing cimport in module 'utility': /home/alendit/envs/xdress/lib/python3.4/site-packages/Cython/Includes/libcpp/map.pxd
missing cimport in module 'pair': /home/alendit/envs/xdress/lib/python3.4/site-packages/Cython/Includes/libcpp/set.pxd
Compiling stlcontainers.pyx because it changed.
Compiling xdress_extra_types.pyx because it changed.
Cythonizing stlcontainers.pyx
Traceback (most recent call last):
File "./setup.py", line 6, in <module>
ext_modules = cythonize("*.pyx", language='c++'),
File "/home/alendit/envs/xdress/lib/python3.4/site-packages/Cython/Build/Dependencies.py", line 798, in cythonize
cythonize_one(*args[1:])
File "/home/alendit/envs/xdress/lib/python3.4/site-packages/Cython/Build/Dependencies.py", line 915, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: stlcontainers.pyx
#!/usr/bin/env python
from setuptools import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize(
'*.pyx',
language='c++'
),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment