python-trio / async_generator

Making it easy to write async iterators in Python 3.5
Other
95 stars 24 forks source link

ctypes.CDLL(None) doesn't work on Windows #5

Closed gdude2002 closed 7 years ago

gdude2002 commented 7 years ago

I was asked to raise this here from https://github.com/SunDwarf/Kyoukai/issues/19

I get a TypeError, bad argument type for built-in operation within Kyoukai, at an import statement (within asyncio_extras: from async_generator import yield_.

njsmith commented 7 years ago

Ugh, no, it's a annoying Linux-vs-Windows thing that makes sense now that I think about it, but... ugh.

njsmith commented 7 years ago

Nope, looks like that didn't actually work: https://ci.appveyor.com/project/njsmith/async-generator/build/job/k9ivyqlnw8mobbfy

njsmith commented 7 years ago

So the problem is that _PyAsyncGenValueWrapperNew is not marked as a PyAPI_FUNC, which means that extensions can happily call it on MacOS and Linux, but on Windows it's impossible to call. @1st1 not sure if this is a bug or what but FYI :-).

This might mean that we can't support yield_from_ in native async generators on Windows, which is a weird sentence to type but here we are.

njsmith commented 7 years ago

Okay, I just pushed async_generator v1.5 to pypi, which should fix this problem. (I found a way that should make it work in principle, but haven't yet figured out how to get ctypes to work properly, so for now I just disabled the clever-hack that was causing this problem.)

1st1 commented 7 years ago

So the problem is that _PyAsyncGenValueWrapperNew is not marked as a PyAPI_FUNC, which means that extensions can happily call it on MacOS and Linux, but on Windows it's impossible to call. @1st1 not sure if this is a bug or what but FYI :-).

It was intentional. I didn't want to mark _PyAsyncGenValueWrapperNew as any kind of API (stable or private), at least until we implement yield from and the design is proven to be correct.