Re: [PyOpenGL-Devel] Extension functions in Python3 on Win32
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2012-04-27 13:04:41
|
On 12-04-27 07:06 AM, Rob Reilink wrote: > Hi, > > We noted that extension functions do not work properly in Py3 on > Win32. The problem is that the function name is passed as a (unicode) > str to Win32Platform.getExtensionProcedure (which is a static method > referring to OpenGL.wglGetProcAddress), which is called from > BasePlatform.constructFunction > > The solution is of course to encode the the name, the question is > where to do this? > > I expect that all platforms that use getExtensionProcedure (those that > have self.EXTENSIONS_USE_BASE_FUNCTIONS==False, i.e. Win32, GLX, > OSMESA) have a function that expects bytes, not str. So I would > propose to put > pointer = self.getExtensionProcedure( as_8_bit(functionName) ) > in BasePlatform.constructFunction. > > Should I go ahead and implement this and create a pull request, or > should this be implemented somewhere else? Ah, apparently function.__name__ has become unicode too, did not realize that. Yeah, that looks like a reasonable place to put the change. Feel free to create a pull request. BTW, is anyone actively using a Python3 version with bzr head? This bug seems like it would make the whole thing a non-starter (if no function will load, it doesn't seem anyone would get anywhere useful). If we're close, I'd prefer to get the major Python3 compatibility changes into at least one beta release of 3.0.2 before we roll out a final. I've got a TODO sitting in my inbox for allowing unicode in GLchar*, but AFAIK that's our only pending 3.x enhancement. If we're a long way from compatibility I may as well push a 3.0.2 beta and plan for 3.0.3 to have Python3 compatibility. Have fun, Mike |