Re: [PyOpenGL-Users] crash on import on Mac OS X after xml-generation merge explained
Brought to you by:
mcfletch
From: rndblnch <rnd...@gm...> - 2014-02-10 21:01:59
|
Mike C. Fletcher <mcfletch <at> vrplumber.com> writes: > > On 14-01-31 05:03 AM, rndblnch wrote: > > Mike C. Fletcher <mcfletch <at> vrplumber.com> writes: > ... > > great, thanks! > > > > on my side, everything is ok on MacOSX 10.9.1, python2.7 & python3.3. > > > > the only regression i found now is when using pypy-2.1 or pypy3-2.1, but > > they are related to pypy's implementation of ctypes, and i am not sure that > > the pypy devs have any interest in fixing it as they are strongly supporting > > cffi now. > > i will report my finding to them anyway. > > by the way, pypy has never sped any of my opengl code... > > Yeah, I'm seeing extremely poor performance under PyPy on what few demos > I can get running without Pygame and Numpy. I fixed the GLUT error you > pointed out, and registered some data-types that have different names in > PyPy vs. CPython, and at least the core tests and a few GLUT Demos now > run under PyPy. > > I'd say we're about ready for a 3.1.0b1 release for wider testing, so > I'll do that the next time I get a few hours to work on PyOpenGL. great! it works for me at r664 except when i pass tuples or lists instead of bytes to functions expecting a pointer to data under pypy (in my case, the last argument of glUniformMatrix3fv). the following patch fixes this (i guess that pypy does not throw the exact same exceptions than cpython): === modified file 'OpenGL/arrays/lists.py' --- OpenGL/arrays/lists.py 2014-01-02 20:27:57 +0000 +++ OpenGL/arrays/lists.py 2014-02-10 20:42:23 +0000 @@ -47,7 +47,7 @@ def from_param( self, instance, typeCode=None ): try: return ctypes.byref( instance ) - except TypeError as err: + except (TypeError, AttributeError) as err: array = self.asArray( instance, typeCode ) pp = ctypes.c_void_p( ctypes.addressof( array ) ) pp._temporary_array_ = (array,) and here the call stack i was getting before applying this patch: File "site-packages/PyOpenGL-3.1.0a4-py3.2.egg/OpenGL/platform/baseplatform.py", line 32, in __call__ return self.func( *args, **named ) File "lib_pypy/_ctypes/function.py", line 339, in __call__ args, kwargs) File "lib_pypy/_ctypes/function.py", line 561, in _convert_args keepalive, newarg, newargtype = self._conv_param(argtype, args[i]) File "/lib_pypy/_ctypes/function.py", line 455, in _conv_param arg = argtype.from_param(arg) File "/site-packages/PyOpenGL-3.1.0a4-py3.2.egg/OpenGL/arrays/arraydatatype.py", line 123, in from_param return cls.getHandler(value).from_param( value, cls.typeConstant ) File "/site-packages/PyOpenGL-3.1.0a4-py3.2.egg/OpenGL/arrays/lists.py", line 49, in from_param return ctypes.byref( instance ) File "/lib_pypy/_ctypes/basics.py", line 174, in byref return pointer(cdata) File "/lib_pypy/_ctypes/pointer.py", line 184, in pointer return POINTER(type(inst))(inst) File "/lib_pypy/_ctypes/pointer.py", line 178, in POINTER {'_type_': cls}) File "/lib_pypy/_ctypes/pointer.py", line 34, in __new__ self.set_type(obj, typedict['_type_']) File "/lib_pypy/_ctypes/pointer.py", line 73, in set_type self._ffiargtype = _ffi.types.Pointer(TP.get_ffi_argtype()) AttributeError: type object 'list' has no attribute 'get_ffi_argtype' renaud > > Have fun, > Mike > |