
I want to wrap termios lib, also for RPython. everything works quite smooth except error reporting. termios.tcgetattr (and others as well) use termios.error for error reporting, which is exception which cannot be used in a translated version. Hence my ll_termios_tcgetattr raises OSError instead (it's not mentioned anywhere in documentation of termios library, nor present in any CPython tests, but well...) So than arises a problem - ll version rises OSError, while default one raises termios.error, which makes everything harder to test (ie the same RPython program behaves differently before and after translation). What is casual solution here? Also any magic wrapping doesn't work here, since termios is a builtin module. Cheers, fijal

Armin Rigo wrote:
Because than, annotator complains about except termios.error, e: e.args[1] I fixed the bug with doing strange hacks in the module-initialization code, I've subclassed the exception and by temporarily re-raising it in module startup, I force e.args to be more regular, but this is a bit ugly trick (there is module/termios/__init__.py function startup for this purpose). Breaks for example compilemodule and it's ugly. Cheers, fijal

Hi Maciek, On Sat, Jun 02, 2007 at 04:50:44PM +0200, Maciek Fijalkowski wrote:
Because than, annotator complains about except termios.error, e: e.args[1]
Ah, because you need to carry an error code. That's the same as with OSError, so you should fix it in the same (hackish) way - grep for OSError in pypy/annotation/ :-) A bientot, Armin.

Armin Rigo wrote:
Because than, annotator complains about except termios.error, e: e.args[1] I fixed the bug with doing strange hacks in the module-initialization code, I've subclassed the exception and by temporarily re-raising it in module startup, I force e.args to be more regular, but this is a bit ugly trick (there is module/termios/__init__.py function startup for this purpose). Breaks for example compilemodule and it's ugly. Cheers, fijal

Hi Maciek, On Sat, Jun 02, 2007 at 04:50:44PM +0200, Maciek Fijalkowski wrote:
Because than, annotator complains about except termios.error, e: e.args[1]
Ah, because you need to carry an error code. That's the same as with OSError, so you should fix it in the same (hackish) way - grep for OSError in pypy/annotation/ :-) A bientot, Armin.
participants (2)
-
Armin Rigo
-
Maciek Fijalkowski