[Pyrex] Pyrexembed test: error message

Martin Dobiasch martin.dobiasch at dobibrennda.at
Fri May 26 17:42:08 UTC 2006


Hello again!

I got a strange error message while playing around with pyrexembed.
This is my code:
test.pyxe
#header{
#include "test.h"
#}header

cdef struct A:
	int a

cdef class PyA:
	cdef A pa
	
	cdef set_value( self, A ptra ) :
		self.pa= ptra
		
	def __len__( self ):
		return 1
	
	property a:
		def __get__ ( self ):
			return self.pa.a

cdef class B:
	cdef void* this
	
	def __init__ ( self ) :
		#embed{ void* B_init()
			return (void* ) ( new B() );
		#}embed
		
		self.this= B_init();
	
	def getA( self ):
		#embed{ A B_getA(void* obj)
			return ( (B* ) obj )->getA();
		#}embed
		
		cdef PyA a
		a= PyA()
		a.set_value( B_getA( self.this ) )
		return a

and this is the error message:
running build
Traceback (most recent call last):
  File "setup.py", line 17, in ?
    build()
  File "setup.py", line 13, in build
    setup(name= "test", ext_modules= Extension("test", ["test.cpp",
  File "/tmp/python.572/usr/lib/python2.4/distutils/core.py", line 149, in setup

  File "/tmp/python.572/usr/lib/python2.4/distutils/dist.py", line 946, in run_c
ommands
  File "/tmp/python.572/usr/lib/python2.4/distutils/dist.py", line 966, in run_c
ommand
  File "/tmp/python.572/usr/lib/python2.4/distutils/command/build.py", line 111,
 in run
  File "/usr/lib/python2.4/cmd.py", line 345, in get_sub_commands
    self.stdout.write("%s\n"%str(header))
  File "/tmp/python.572/usr/lib/python2.4/distutils/command/build.py", line 124,
 in has_ext_modules
  File "/tmp/python.572/usr/lib/python2.4/distutils/dist.py", line 976, in has_e
xt_modules
AttributeError: Extension instance has no attribute '__len__'

Im using cygwin





More information about the Pyrex mailing list