<ajlawrence>
I am currently adding some win32 functionality to the sockets in PyPy (the share method) . Are there any rules governing the level in the interpretter where this functionality should live? I started extending interp_socket.py but I am now debating whether this should really go into rsocket.py
<mattip>
if it is python-specific it goes in pypy, if it could theoretically serve others then rsocket.py
<mattip>
but handling errors from rpython is limited
<ajlawrence>
It does seem to be a python-specific method so I will stick it in pypy.
<ajlawrence>
What does this mean? [translation:ERROR] AnnotatorError: Don't know how to represent <module 'sys' (built-in)>
<ajlawrence>
I would like to do " if sys.platform == 'win32' " in some code.
<mattip>
it should be outside the function, see examples in something like pypy/module/sys/interp_encoding.py
<mattip>
and should set a global variable
<ajlawrence>
I have seen it outside the function. I was wondering why it does not work.
<ajlawrence>
I think the best solution for me is to set a global variable.
<mattip>
global scope should work, it is handled at import time so before annotation
<ajlawrence>
Ok
<ajlawrence>
What is an UnionError?
<simpson>
It means that two different types were given to a single variable/attribute, and the types couldn't be unified.
<mattip>
during annotation, the function arguments and return type are analyzed. It is called once with one type of argument and returns something,
<mattip>
then the next time it is used it is called with something different or returns something different
<mattip>
so something like str and unicode, or different int types
<mattip>
note these are usually rpython types, not W_Root types since the latter can be unified (usually)
<mattip>
I tend to think of rpython types like C, and W_Root like python classes
<ajlawrence>
It seems like I have tried to use a W_Root type in a function that expects an rpython type.
<mattip>
pastebin the code?
<mattip>
space.int_w for ints, space.text_w for str/bytes