Figured out part of the wonkiness (Amazing what happens when you read the XXX comments...)


For those of you who don't program, XXX comments are not blue/off-colour comments, but "I'm moving too fast here to stop and try to figure out how to deal with this corner case, come back and consider it when ready" (or something to that effect). Some IDEs will even build a todo list out of the XXX comments for you.

Anyway, one of the XXX comments in the OpenGL-ctypes project reads:
	# XXX should set basic error checking function here, but then also need to 
# disable it if we use wrapper so that we're not running it twice...

so, in short, only the wrapped functions (basically those with pointer data-types) are currently getting error-checked. This is likely why I saw weirdly inappropriate errors show up in certain runs (which is how I remembered to check for error-checking, of course).

Anyway, what I'm planning on doing is eliminating the error-checking code in the wrapper and using the base ctypes restype hook to set up the error checking on the base wrappers. The wrapper code will then just trap the exception and add the extra information (i.e. what parameters were involved).

Unfortunately, I couldn't figure out how to duplicate the restype hook for the non-error case when there is no error... so didn't get very far tonight. Of course, having a 4-hour nap didn't help much on getting stuff done, but my hands do feel better :) .

Comments

Comments are closed.

Pingbacks

Pingbacks are closed.