Sys.exit in secondary threads

2010-10-08 Thread Pakal
I've noticed that there is nothing in python's documentation regarding the use of sys.exit(code) in a non-main thread. As far as I've seen, the behaviour in this case is to simply exit the thread, without caring about the return code. in the main thread however, the return code becomes the

Castrated traceback in sys.exc_info()

2010-03-17 Thread Pakal
Hello I've just realized recently that sys.exc_info() didn't return a full traceback for exception concerned : it actually only contains the frame below the point of exception catching. That's very annoying to me, because I planned to log such tracebacks with logging.critical(*,

Re: Direct use of bytearray buffers with ctypes ?

2010-01-10 Thread Pakal
Oki, it seems I've found. To directly use a bytearray buffer from ctypes, you must first create a compatible ctypes type (I.E, a char array of same size), and only then instanciate this new type with newtype.from_buffer (bytearray_object). The little danger is : you must NOT change the size of

Direct use of bytearray buffers with ctypes ?

2010-01-09 Thread Pakal
Hello I'm having big trouble wrapping the win32 ReadFile() function with ctypes. I wanted to allow the user to give a bytearray to this function, so that the writable buffer of this bytearray is directly used to receive the data from the file ; thus, no temporary copy in a separate ctype buffer