Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling aclose() on StreamReader ? #30

Closed
DrTom opened this issue Nov 14, 2019 · 4 comments
Closed

Calling aclose() on StreamReader ? #30

DrTom opened this issue Nov 14, 2019 · 4 comments

Comments

@DrTom
Copy link

DrTom commented Nov 14, 2019

When closing a StreamReader e.g. as in:

 sr, sw = await asyncio.open_connection(host, port, ssl=use_ssl)
 # ....
 await sr.aclose()

the program will crash. My code runs also on cpython and interestingly the corresponding StreamReader on that platform doesn't even have a .close() method.

So my the questions is: am I even supposed to call sr.aclose() (and if not why does it exist)?

@peterhinch
Copy link
Owner

peterhinch commented Nov 15, 2019

I think the method should not exist.

Are you running official uasyncio V2 or my fast_io fork? If you are running fast_io I suggest you re-test with the official version. If the official version fails, please could you raise an issue against MicroPython as I am not a maintainer for the official version.

If only fast_io fails, please report back and I will remove the method.

Please also see the new uasyncio. This has no aclose but does have

    def close(self):
        pass
    async def wait_closed(self):
        # TODO yield?
        self.s.close()

@DrTom
Copy link
Author

DrTom commented Nov 15, 2019

I installed asyncio via upip as you suggested in your tutorial, which is very helpful by the way. So it is not your "fast" version. I am not sure if it is the "official" version because https://pypi.org/ points to https://github.com/pfalcon/pycopy-lib via its homepage link. I just found that out and so I am a bit confused because I assumed that upip would pull the official version. Those micropython forks are a bit disorienting for people new to the eco system (like me).

Anyways, I write my code portable between cpython and micropython and the mentioned new uasyicio seems to make this easier. I will give it a try once released.

@peterhinch
Copy link
Owner

upip does pull in the official version, from a repository other than PyPi. You may want to raise an issue against MicroPython - that is up to you. I gather the existing version will be retained under a new name.

In my opinion, having been involved in testing, the new version is excellent. It includes features from CPython 3.8 and a primary design aim is improving CPython compatibility.

In due course I plan to change this repo to support the new version. The tutorial should only need minor changes.

@DrTom
Copy link
Author

DrTom commented Nov 21, 2019

I am fairly sure now, that used library originaly stems from https://github.com/pfalcon/pycopy-lib and I as far as I can reconstruct it was pulled via upip. I will keep it for now. I disabled await on the reader https://github.com/DrTom/py-u-async-http-client/blob/ee7a25a509c13a9db35acc6375c2ce12b4816a62/http_client/core.py#L40 . I plan to migrate to the new asyncio version as suggested. At any rate has the problem nothing to do with this project and I am closing this issue.

@DrTom DrTom closed this as completed Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants