Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weave does not work with numpy arrays of dtype="O" (Trac #601) #1128

Closed
Tracked by #7
scipy-gitbot opened this issue Apr 25, 2013 · 2 comments
Closed
Tracked by #7

weave does not work with numpy arrays of dtype="O" (Trac #601) #1128

scipy-gitbot opened this issue Apr 25, 2013 · 2 comments
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected Migrated from Trac

Comments

@scipy-gitbot
Copy link

Original ticket http://projects.scipy.org/scipy/ticket/601 on 2008-02-08 by trac user ceball, assigned to unknown.

If you attempt to pass an array of dtype="O" to Weave, you get an error:

<weave: compiling>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "test_weave.py", line 74, in __call__
    inline(code, ['some_array'], local_dict=locals())
  File "test_weave.py", line 16, in inline
    weave.inline(*params,**named_params)
  File "[weave location]/weave/inline_tools.py", line 333, in inline
    **kw)
  File "[weave location]/weave/inline_tools.py", line 459, in compile_function
    verbose=verbose, **kw)
  File "[weave location]/weave/ext_tools.py", line 353, in compile
    kw,file = self.build_kw_and_file(location,kw)
  File "[weave location]/weave/ext_tools.py", line 334, in build_kw_and_file
    file = self.generate_file(location=location)
  File "[weave location]/weave/ext_tools.py", line 295, in generate_file
    code = self.module_code()
  File "[weave location]/weave/ext_tools.py", line 203, in module_code
    self.function_code(),
  File "[weave location]/weave/ext_tools.py", line 269, in function_code
    all_function_code += func.function_code()
  File "[weave location]/weave/inline_tools.py", line 77, in function_code
    decl_code = indent(self.arg_declaration_code(),4)
  File "[weave location]/weave/inline_tools.py", line 62, in arg_declaration_code
    for arg in self.arg_specs]
  File "[weave location]/weave/standard_array_spec.py", line 158, in
declaration_code
    res = self.template_vars(inline=inline)
  File "[weave location]/weave/standard_array_spec.py", line 151, in template_vars
    res['num_type'] = num_to_c_types[self.var_type]
KeyError: 'O'

This is using a copy of weave checked out from SVN:

URL: http://svn.scipy.org/svn/scipy/trunk/scipy/weave
Revision: 3809
Last Changed Rev: 3736
Last Changed Date: 2007-12-28 06:53:35 +0800 (Fri, 28 Dec 2007)
Properties Last Updated: 2008-01-09 15:16:42 +0800 (Wed, 09 Jan 2008)

(and Python 2.5.1 with numpy 1.0.2).

The following message to SciPy-User gives code you can use to reproduce this error:
http://thread.gmane.org/gmane.comp.python.scientific.user/14642

The following message to SciPy-Devel gives an attempt at a patch to solve the problem:
http://article.gmane.org/gmane.comp.python.scientific.devel/7264

The patch certainly fixes the error above, but it is clearly not a complete solution because there is still a problem using arrays of objects from C code in Weave. The message above also gives code to demonstrate this subsequent problem.

Additionally, there is some C code for iterating through an array of objects that works when called from Instant, but that does not work when called from Weave (as patched above):
http://thread.gmane.org/gmane.comp.python.numeric.general/18818/focus=18863

@scipy-gitbot
Copy link
Author

trac user ceball wrote on 2008-02-08

The "Instant" referred to above is:
http://www.fenics.org/wiki/Instant

@person142
Copy link
Member

Closing since weave is no longer a part of SciPy. This issue is now tracked at scipy/weave#7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected Migrated from Trac
Projects
None yet
Development

No branches or pull requests

2 participants