New submission from Ivan Pozdeev: 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) ---------- components: ctypes messages: 228423 nosy: Ivan.Pozdeev priority: normal severity: normal status: open title: ctypes.LibraryLoader returns singleton objects, resulting in usage conflicts type: crash versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22552> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com