Message228423
a LibraryLoader returns the same _FuncPtr object for a given function every time. This way, if two libraries set its attributes (most possibly, `argtypes') to incompatible values (both representing the same C-level entities), one of them will stop working.
I've just discovered such a problem with `pyreadline' and `colorama' which both utilize `windll.kernel32.GetConsoleScreenBufferInfo'.
One solution is to make LibraryLoader return a new object each time. Another (worse IMO) is to provide a clone function for _FuncPtr (it cannot be clones by `copy.copy()').
An example code:
>>> import pyreadline
>>> import pip._vendor.colorama
Readline internal error
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pyreadline\console\console.py", line 768,
in hook_wrapper_23
res = ensure_str(readline_hook(prompt))
File "c:\python27\lib\site-packages\pyreadline\rlmain.py", line 569, in readline
self.readline_setup(prompt)
File "c:\python27\lib\site-packages\pyreadline\rlmain.py", line 565, in readline_setup
self._print_prompt()
File "c:\python27\lib\site-packages\pyreadline\rlmain.py", line 466, in _print_prompt
x, y = c.pos()
File "c:\python27\lib\site-packages\pyreadline\console\console.py", line 261,
in pos
self.GetConsoleScreenBufferInfo(self.hout, byref(info))
ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected LP_CONSOLE_SCREEN_BUFFER_INFO instance instead of pointer to CONSOLE_SCREEN_BUFFER_INFO
(the same error is printed continuously, on Ctrl-C, the interpreter crashes) |
|
Date |
User |
Action |
Args |
2014-10-04 01:54:49 | Ivan.Pozdeev | set | recipients:
+ Ivan.Pozdeev |
2014-10-04 01:54:49 | Ivan.Pozdeev | set | messageid: <1412387689.66.0.814406977046.issue22552@psf.upfronthosting.co.za> |
2014-10-04 01:54:49 | Ivan.Pozdeev | link | issue22552 messages |
2014-10-04 01:54:48 | Ivan.Pozdeev | create | |
|