[issue28639] inspect.isawaitable(native_coro) returns int

2016-11-07 Thread Justin Mayfield
New submission from Justin Mayfield: Patch available on my github fork.. https://github.com/mayfield/cpython/commit/8d50cc61f42fa280d380e9c10c420c949a619bef -- components: asyncio messages: 280280 nosy: Justin Mayfield, gvanrossum, yselivanov priority: normal severity: normal status

[issue24837] await process.wait() does not work with a new_event_loop

2016-09-04 Thread Justin Mayfield
Justin Mayfield added the comment: I agree with Guido. I spent a couple hours trying to debug some of my own code that turned out to be this issue. My use case is single threaded too. Perhaps I'm daft but I don't understand why the child watcher is part of the event loop policy. At first

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2016-02-10 Thread Justin Mayfield
Justin Mayfield added the comment: Alexander, That sounds unrelated. I'd treat it as a new issue until you have concrete evidence to the contrary. Also on face value it sounds like it might just be your operating systems open file limit. On OSX I think the default open file limit

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-19 Thread Justin Mayfield
Justin Mayfield added the comment: I should have commented more on the run_once removal. The depiction given in its docstring seemed inconsistent with the new way stop works and I found no callers, so it seemed like it was best left out to avoid confusion. No worries though, I didn't get

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-19 Thread Justin Mayfield
Justin Mayfield added the comment: Ha, email race. Regarding rev 2, the updated docstring and scheduled stop looks good along with alleviating the confusion I mentioned. I'm not sure about your warning comment; Perhaps that's a patch I didn't lay eyes on. Cheers

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-19 Thread Justin Mayfield
Justin Mayfield added the comment: I see. Seems like good discussion over there. I joined up. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-17 Thread Justin Mayfield
Justin Mayfield added the comment: Attached patch submission for stop flag proposal. I assume you didn't mean a github PR since the dev docs seem to indicate that is for readonly usage. This passes all the tests on my osx box but it should obviously be run by a lot more folks

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-16 Thread Justin Mayfield
Justin Mayfield added the comment: You bet. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25593> ___ ___ Python-bugs-list

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-16 Thread Justin Mayfield
Justin Mayfield added the comment: +1 Let me know what I can do to help. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-12 Thread Justin Mayfield
Justin Mayfield added the comment: Interesting. I was going to do an analysis what using _ready.appendleft() for adding selector events would do for that scenario. The idea being to consistently juxtapose exiting callbacks, selector events and new callbacks. However I think this just moves

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-12 Thread Justin Mayfield
Justin Mayfield added the comment: Yes, that's what I was suggesting. Looking at tornado they do the stop between callbacks/matured-scheduled and events. That approach seems somewhat arbitrary to me at first glance but tornado is very mature and they usually have good reasons for what

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-11 Thread Justin Mayfield
Justin Mayfield added the comment: I don't believe this is a case of nonidempotent callbacks, unless you are referring to Future.set_result(), which by design can't be called twice. The callbacks are given an inconsistent opportunity to modify the poll set because of indeterminacy

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-11 Thread Justin Mayfield
Justin Mayfield added the comment: Guido, Shouldn't this not be the case for level triggered polling? From looking at selectors it looks like these are always level triggered which means they should only event once. -- ___ Python tracker <

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-11 Thread Justin Mayfield
Justin Mayfield added the comment: Attached server side of repro. -- Added file: http://bugs.python.org/file41017/Issue25593_repro_server.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-11 Thread Justin Mayfield
Justin Mayfield added the comment: Just reproduced on Linux, Fedora Core 23. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-11 Thread Justin Mayfield
Justin Mayfield added the comment: Attaching simplified test setup. It does take some doing to repro so the local async server is required to make it happen (for me). When I tried just pointing to python.org it would not repro in 100 iterations, but using a local dummy server repros 100

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-11 Thread Justin Mayfield
Justin Mayfield added the comment: Nevermind, in the case of writeablity it won't matter either way. -- So in looking at tornado's ioloop they run the ready callbacks before calling poll(). So the callbacks can modify the poll set. -- ___ Python

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-11 Thread Justin Mayfield
Justin Mayfield added the comment: This code repros without aiohttp when pitted against the previously attached web server (again on OSX 10.11, mid-2012 MBPr). Admittedly this may seem very arbitrary but I have better reasons in my production code for stopping an IOLoop and starting it again

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-11 Thread Justin Mayfield
Justin Mayfield added the comment: I'm attaching a patch that runs `_ready` callbacks at the start of `_run_once`. The style and implications are ranging so I leave it to you at this point. -- keywords: +patch Added file: http://bugs.python.org/file41019

[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2015-11-11 Thread Justin Mayfield
Justin Mayfield added the comment: I believe I'm seeing this bug in a non-threaded and non-forked env. System: OSX 10.11.1 (15B42) Python 3.5.0 (from brew install) I'm using aiohttp to create several dozens of HTTP connections to the same server (an async tornado web server). Nothing

Re: Bit fields in python?

2010-09-08 Thread Justin Mayfield
Instead of rewriting your code you might consider wrapping it with the C-API. I prefer this approach (over ctypes) for anything low level. http://docs.python.org/c-api/ On 09/06/2010 10:06 PM, Kwan Lai Cheng wrote: Hi, I'm trying to rewrite a c program in python encountered several