[issue32273] Remove asyncio.test_utils

2017-12-11 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 3e9751819ad13a965e8be13c1e5bc5a6811fe6b8 by Yury Selivanov in branch 'master': bpo-32273: Move asyncio.test_utils to test.test_asyncio (#4785) https://github.com/python/cpython/commit/3e9751819ad13a965e8be13c1e5bc5

[issue32269] Add `asyncio.get_running_loop()` function

2017-12-11 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue32269] Add `asyncio.get_running_loop()` function

2017-12-11 Thread Yury Selivanov
Yury Selivanov added the comment: > `asyncio._get_running_loop()` will be deprecated and removed in Python 3.9. _get_running_loop() was left as-is. -- ___ Python tracker <https://bugs.python.org/issu

[issue32251] Add asyncio.BufferedProtocol

2017-12-11 Thread Yury Selivanov
Yury Selivanov added the comment: > See https://eklitzke.org/goroutines-nonblocking-io-and-memory-usage for an > interesting discussion of the drawbacks of some buffer handling idioms. Thanks for the link! It does make sense to use a pool of buffers for the proposed BufferedProtocol

[issue32251] Add asyncio.BufferedProtocol

2017-12-11 Thread Yury Selivanov
Yury Selivanov added the comment: >> Looks nice. Can it speed up aiohttp too? > Yes. > aiohttp uses own streams but public API and internal implementation are > pretty close to asyncio streams. > Moreover C accelerated HTTP parser should work with proposed BufferedProtocol

[issue32296] Implement asyncio._get_running_loop() and get_event_loop() in C

2017-12-12 Thread Yury Selivanov
New submission from Yury Selivanov : asyncio.get_event_loop(), and, subsequently asyncio._get_running_loop() are one of the most frequently executed functions in asyncio. They also can't be sped up by third-party event loops like uvloop. When implemented in C they become 4x f

[issue32296] Implement asyncio._get_running_loop() and get_event_loop() in C

2017-12-12 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4719 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32296> ___ ___ Py

[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2017-12-13 Thread Yury Selivanov
Yury Selivanov added the comment: First, I've no questions about the proposed implementation. It shouldn't have performance impact when unawaited coroutine tracking is off, which is the default. It will cause minimal overhead when the tracking is on, which is fine. Adding

[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2017-12-13 Thread Yury Selivanov
Yury Selivanov added the comment: > send_ping() # don't care about result, forgot await > # get collected > await something_that_will_trigger_check_coros_weakreaf() # oh no ! I don't understand what you are trying to say with thi

[issue32296] Implement asyncio._get_running_loop() and get_event_loop() in C

2017-12-13 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset a70232f28882d2fecb3ebe06643867701016070f by Yury Selivanov in branch 'master': bpo-32296: Implement asyncio.get_event_loop and _get_running_loop in C. (#4827) https://github.com/python/cpython/commit/a70232f28882d2fecb3ebe06643867

[issue32296] Implement asyncio._get_running_loop() and get_event_loop() in C

2017-12-13 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> performance ___ Python tracker <https://bugs.python

[issue32309] Implement asyncio.create_task() and asyncio.run_in_executor shortcuts

2017-12-13 Thread Yury Selivanov
Yury Selivanov added the comment: I don't like the low-level API of run_in_executor. "executor" being the first argument, the inability to pass **kwargs, etc. I'd expect to see a more high-level API, perhaps the one that supports 'async with': async wit

[issue32296] Implement asyncio._get_running_loop() and get_event_loop() in C

2017-12-13 Thread Yury Selivanov
Change by Yury Selivanov : -- pull_requests: +4739 stage: resolved -> patch review ___ Python tracker <https://bugs.python.org/issue32296> ___ ___ Python-

[issue32296] Implement asyncio._get_running_loop() and get_event_loop() in C

2017-12-13 Thread Yury Selivanov
Yury Selivanov added the comment: Thanks Victor. I've made a PR to fix this. -- ___ Python tracker <https://bugs.python.org/issue32296> ___ ___ Pytho

[issue32314] Implement asyncio.run()

2017-12-13 Thread Yury Selivanov
New submission from Yury Selivanov : There's a fairly extensive discussion here: https://github.com/python/asyncio/pull/465 In short, asyncio.run() is a pretty straightforward addition, so let's add it. The discussion was more focused on the asyncio.run_forever() proposal. I now

[issue32314] Implement asyncio.run()

2017-12-13 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4741 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32314> ___ ___ Py

[issue32314] Implement asyncio.run()

2017-12-13 Thread Yury Selivanov
Yury Selivanov added the comment: I'll open a separate issue to improve Server's API. AFAIK it's the main reason for having run_forever(). -- ___ Python tracker <https://bugs.pyt

[issue32296] Implement asyncio._get_running_loop() and get_event_loop() in C

2017-12-13 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset bfbf04ef18c93ca8cab0453f76aeea1d8fc23fb1 by Yury Selivanov in branch 'master': bpo-32296: Unbreak tests on Windows (#4850) https://github.com/python/cpython/commit/bfbf04ef18c93ca8cab0453f76aeea

[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2017-12-13 Thread Yury Selivanov
Yury Selivanov added the comment: Matthias, Thanks a lot for such a detailed write-up! I now better understand how you want to use the proposed API in Trio, and why the weakref approach isn't going to work (at least not in a straightforward way). >> 2. What if another fra

[issue30241] Add contextlib.AbstractAsyncContextManager

2017-12-13 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 176baa326be4ec2dc70ca0c054b7e2ab7ca6a9cf by Yury Selivanov (Jelle Zijlstra) in branch 'master': bpo-30241: implement contextlib.AbstractAsyncContextManager (#1412) https://github.com/python/cpython/commit/176baa326be4ec2dc70ca0c054b7e2

[issue30241] Add contextlib.AbstractAsyncContextManager

2017-12-13 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue30241> ___ ___

[issue32318] Remove "globals()" call from "socket.accept()"

2017-12-13 Thread Yury Selivanov
Change by Yury Selivanov : -- nosy: yselivanov priority: normal severity: normal status: open title: Remove "globals()" call from "socket.accept()" ___ Python tracker <https://bug

[issue32318] Remove "globals()" call from "socket.accept()"

2017-12-13 Thread Yury Selivanov
New submission from Yury Selivanov : socket.accept currently has this code: type = self.type & ~globals().get("SOCK_NONBLOCK", 0) which I believe is (a) bad Python style; (b) slows things down. -- components: +Library (Lib) nosy: +asvetlov, vstinner type: -> enh

[issue32318] Remove "globals()" call from "socket.accept()"

2017-12-13 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4746 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32318> ___ ___ Py

[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2017-12-13 Thread Yury Selivanov
Yury Selivanov added the comment: > So first... that's not how nursery.start_soon works :-). It actually takes an > async function, not a coroutine object. [..] Interesting, and I think I like it. I definitely understand the motivation to not tell users the difference betwee

[issue32314] Implement asyncio.run()

2017-12-14 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 02a0a19206da6902c3855a1fa09e60b208474cfa by Yury Selivanov in branch 'master': bpo-32314: Implement asyncio.run() (#4852) https://github.com/python/cpython/commit/02a0a19206da6902c3855a1fa09e60

[issue32314] Implement asyncio.run()

2017-12-14 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue32314] Implement asyncio.run()

2017-12-14 Thread Yury Selivanov
Yury Selivanov added the comment: > Wow, I really love your new function. Thanks Yury! asyncio examples in the > doc look much better now! This year I'll stay for the sprints at PyCon, and will focus on improving the docs further. I needed asyncio.r

[issue32311] Implement asyncio.create_task() shortcut

2017-12-14 Thread Yury Selivanov
New submission from Yury Selivanov : There's a lengthy discussion of this proposal over here: https://github.com/python/asyncio/issues/477 Guido there likes the idea of adding asyncio.create_task(), so let's add it. -- ___ Python track

[issue32327] Make asyncio methods documented as coroutines - coroutines.

2017-12-14 Thread Yury Selivanov
Change by Yury Selivanov : -- nosy: +asvetlov ___ Python tracker <https://bugs.python.org/issue32327> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32327] Make asyncio methods documented as coroutines - coroutines.

2017-12-14 Thread Yury Selivanov
New submission from Yury Selivanov : There's a handful of event loop methods that are currently documented as coroutines, but in reality they return asyncio.Future: * loop.sock_sendall, * loop.sock_accept, * loop.sock_recv, and * loop.run_in_executor. These methods need to become p

[issue32327] Make asyncio methods documented as coroutines - coroutines.

2017-12-14 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4765 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32327> ___ ___ Py

[issue32327] Make asyncio methods documented as coroutines - coroutines.

2017-12-14 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 19a44f63c738388ef3c8515348b4ffc061dfd627 by Yury Selivanov in branch 'master': bpo-32327: Convert asyncio functions documented as coroutines to coroutines. (#4872) https://github.com/python/cpyt

[issue32327] Make asyncio methods documented as coroutines - coroutines.

2017-12-14 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue32331] apply SOCK_TYPE_MASK to socket.type on Linux

2017-12-14 Thread Yury Selivanov
New submission from Yury Selivanov : On Linux, socket type is both a socket type and a bit mask (of SOCK_CLOEXEC and SOCK_NONBLOCK). Therefore, anyone who write code like 'if sock.type == SOCK_STREAM' writes non-portable code, that occasionally breaks on Linux. This caused so

[issue32331] apply SOCK_TYPE_MASK to socket.type on Linux

2017-12-14 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4771 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32331> ___ ___ Py

[issue32332] Implement slots support for magic methods added in PEP 560

2017-12-14 Thread Yury Selivanov
New submission from Yury Selivanov : I propose to add type slots for magic methods introduced by PEP 560. In the brief discussion on the mailing list Guido OK'd the idea: https://mail.python.org/pipermail/python-dev/2017-December/151262.html I'll submit a PR that implements this p

[issue32332] Implement slots support for magic methods added in PEP 560

2017-12-14 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4772 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32332> ___ ___ Py

[issue32311] Implement asyncio.create_task() shortcut

2017-12-14 Thread Yury Selivanov
Yury Selivanov added the comment: Thank you, Andrew! -- ___ Python tracker <https://bugs.python.org/issue32311> ___ ___ Python-bugs-list mailing list Unsub

[issue32332] Implement slots support for magic methods added in PEP 560

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: Serhiy, I've tested METH_STATIC approach and it works just fine. Thanks for pointing that out! I agree that adding slots for something that's already possible is an overkill, so let's close this issue. -- resolution: -> rej

[issue32331] apply SOCK_TYPE_MASK to socket.type on Linux

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: > You can easily work around your problem by replacing "sock.type == > SOCK_STREAM" with "sock.type & SOCK_STREAM == SOCK_STREAM". Heh :) No, that would be a buggy code. Try this on your Linux box: (socket.SOCK_

[issue32331] apply SOCK_TYPE_MASK to socket.type on Linux

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: On GH (https://github.com/python/cpython/pull/4877), Antoine wrote: > I agree with Victor: > it can't go into 3.6 > making the change in 3.7 is contentious > Can there be an other way to solve the issue? Can we for example keep > socket.t

[issue32331] Add socket.truetype property

2017-12-15 Thread Yury Selivanov
Change by Yury Selivanov : -- title: apply SOCK_TYPE_MASK to socket.type on Linux -> Add socket.truetype property ___ Python tracker <https://bugs.python.org/issu

[issue32331] Add socket.truetype property

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: Update: I've rewritten the PR from scratch. 1. SOCK_TYPE_MASK isn't exported on Linux. Therefore we will not export socket.SOCK_TYPE_MASK too. 2. I've added the new socket.truetype property. 3. When a socket is created without an FD, e.g.

[issue28134] socket.socket(fileno=fd) does not work as documented

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: Let's quickly iterate over what's possible first: * It's possible to check the type of the FD using "getsockopt(SOL_SOCKET, SO_TYPE)" on all platforms. * It's possible to check family/proto of the FD using "getsockopt(SOL_

[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset e796b2fe26f220107ac50667de6cc86c82b465e3 by Yury Selivanov in branch 'master': bpo-27456: Ensure TCP_NODELAY is set on linux (#4231) https://github.com/python/cpython/commit/e796b2fe26f220107ac50667de6cc8

[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-15 Thread Yury Selivanov
Change by Yury Selivanov : -- pull_requests: +4791 ___ Python tracker <https://bugs.python.org/issue27456> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-15 Thread Yury Selivanov
Change by Yury Selivanov : -- pull_requests: +4792 ___ Python tracker <https://bugs.python.org/issue27456> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32331] Add socket.truetype property

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: Another name option: socket.realtype -- ___ Python tracker <https://bugs.python.org/issue32331> ___ ___ Python-bugs-list mailin

[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 572636d42566da8eb6e85d5b8164e9ed8860a255 by Yury Selivanov in branch '3.6': bpo-27456: Ensure TCP_NODELAY is set on linux (#4231) (#4898) https://github.com/python/cpython/commit/572636d42566da8eb6e85d5b8164e9

[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-15 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue32331] Add socket.truetype property

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: I've been thinking a lot about this problem, and I'm really tempted to fix sock.type property: 1. The problem first appeared in Python 3.2. 2. Python 2.7 doesn't have this problem at all, and doesn't even export socket.SOCK_NONBLOCK. I

[issue32331] Add socket.truetype property

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: There's also a precedent of us breaking socket API. In Python < 3.6: sock = socket.socket() fd = sock.fileno() os.close(fd) sock.close() Everything works fine. In 3.6+: sock.close() # Will raise OSError uvloop broke on this during

[issue32331] Fix socket.type on Linux

2017-12-15 Thread Yury Selivanov
Change by Yury Selivanov : -- title: Add socket.truetype property -> Fix socket.type on Linux ___ Python tracker <https://bugs.python.org/issue32331> ___ ___ Py

[issue32331] Fix socket.type on Linux

2017-12-15 Thread Yury Selivanov
Yury Selivanov added the comment: Nathaniel, thanks a lot for the comprehensive analysis. It's now obvious that this weird Linux-specific socket.type quirk is of our own making and specific only to Python. I've updated the PR: 1. *type* argument of 'socket.socket()' i

[issue32348] Optimize asyncio.Future schedule/add/remove callback

2017-12-16 Thread Yury Selivanov
New submission from Yury Selivanov : Key observation: 99.9% of the time Futures and Tasks have only one callback. Currently we have a list of callbacks in each Future/Task. We can avoid list object allocation if we add a field to store the first callback. This way we'll only need to

[issue32348] Optimize asyncio.Future schedule/add/remove callback

2017-12-16 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4801 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32348> ___ ___ Py

[issue32348] Optimize asyncio.Future schedule/add/remove callback

2017-12-17 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 1b7c11ff0ee3efafbf5b38c3c6f37de5d63efb81 by Yury Selivanov in branch 'master': bpo-32348: Optimize asyncio.Future schedule/add/remove callback. (#4907) https://github.com/python/cpython/commit/1b7c11ff0ee3efafbf5b38c3c6f37d

[issue32348] Optimize asyncio.Future schedule/add/remove callback

2017-12-17 Thread Yury Selivanov
Yury Selivanov added the comment: The attached benchmark from https://bugs.python.org/issue32204 shows that the updated Task is 15% faster. -- Added file: https://bugs.python.org/file47335/t.py ___ Python tracker <https://bugs.python.

[issue32348] Optimize asyncio.Future schedule/add/remove callback

2017-12-17 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue32204] async/await performance is very low

2017-12-17 Thread Yury Selivanov
Yury Selivanov added the comment: Liran, Task (C implementation) was optimized in issue 32348; your benchmark now runs 15% faster. -- ___ Python tracker <https://bugs.python.org/issue32

[issue32355] Optimize asyncio.gather()

2017-12-17 Thread Yury Selivanov
New submission from Yury Selivanov : asyncio.gather can be made faster if: 1. we don't use functools.partial 2. create less intermittent collections 3. drop unnecessary code (e.g. gather has some code that's duplicated in ensure_future that it uses etc) The proposed PR makes asyncio

[issue32355] Optimize asyncio.gather()

2017-12-17 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4807 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32355> ___ ___ Py

[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-17 Thread Yury Selivanov
Change by Yury Selivanov : -- nosy: +asvetlov ___ Python tracker <https://bugs.python.org/issue32356> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-17 Thread Yury Selivanov
New submission from Yury Selivanov : As briefly discussed on https://github.com/python/asyncio/issues/488 and https://github.com/python/cpython/pull/528 -- messages: 308509 nosy: yselivanov priority: normal severity: normal status: open title: asyncio: Make transport.pause_reading

[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-17 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4808 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32356> ___ ___ Py

[issue30050] Please provide a way to disable the warning printed if the signal module's wakeup fd overflows

2017-12-17 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 902ab80b590e474bb2077b1fae8aac497b856d66 by Yury Selivanov (Nathaniel J. Smith) in branch 'master': bpo-30050: Allow disabling full buffer warnings in signal.set_wakeup_fd (#4792) https://github.com/python/cpyt

[issue30050] Please provide a way to disable the warning printed if the signal module's wakeup fd overflows

2017-12-17 Thread Yury Selivanov
Yury Selivanov added the comment: I think that what Nathaniel proposes is very reasonable. The PR is LGTM and I've just merged it. Closing the issue. -- components: +Interpreter Core resolution: -> fixed stage: patch review -> resolved status: open -> closed type:

[issue32204] async/await performance is very low

2017-12-17 Thread Yury Selivanov
Yury Selivanov added the comment: NP. I have another PR in the pipeline: https://github.com/python/cpython/pull/4913 Both optimizations make your benchmark run 30% faster on 3.7. If you compile asyncio.gather() with Cython you will get it another 5-15% faster. If you use uvloop - another

[issue32357] Optimize asyncio.iscoroutine() for non-native coroutines

2017-12-17 Thread Yury Selivanov
New submission from Yury Selivanov : asyncio.Task now uses asyncio.iscoroutine() to give a comprehensible error if a user creates a Task for a non-awaitable type. The problem is that iscoroutine() is quite expensive for non-native coroutines (like the ones compiled with Cython), as it uses

[issue32357] Optimize asyncio.iscoroutine() and loop.create_task() for non-native coroutines

2017-12-17 Thread Yury Selivanov
Change by Yury Selivanov : -- title: Optimize asyncio.iscoroutine() for non-native coroutines -> Optimize asyncio.iscoroutine() and loop.create_task() for non-native coroutines ___ Python tracker <https://bugs.python.org/issu

[issue32357] Optimize asyncio.iscoroutine() and loop.create_task() for non-native coroutines

2017-12-17 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4809 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32357> ___ ___ Py

[issue32357] Optimize asyncio.iscoroutine() and loop.create_task() for non-native coroutines

2017-12-18 Thread Yury Selivanov
Change by Yury Selivanov : Added file: https://bugs.python.org/file47337/bench.py ___ Python tracker <https://bugs.python.org/issue32357> ___ ___ Python-bugs-list mailin

[issue32364] Add AbstractFuture and AbstractTask

2017-12-18 Thread Yury Selivanov
Yury Selivanov added the comment: +1, let's do it. I'd add a new module - 'asyncio.abc' and put them both there (as well as asyncio.isfuture() function). -- ___ Python tracker <https://bug

[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-18 Thread Yury Selivanov
Yury Selivanov added the comment: +1. -- ___ Python tracker <https://bugs.python.org/issue32363> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-18 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset d757aaf9dd767d13205bf9917e520ebf43e7f6e5 by Yury Selivanov in branch 'master': bpo-32356: idempotent pause_/resume_reading; new is_reading method. (#4914) https://github.com/python/cpython/commit/d757aaf9dd767d13205bf9917e520e

[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-18 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue32331] Fix socket.type on Linux

2017-12-18 Thread Yury Selivanov
Yury Selivanov added the comment: > This issue is not specific to Linux. FreeBSD is also affected: So instead of '#ifdef __linux__' we should use `#ifdef SOCK_NONBLOCK` etc. I'll update the PR. -- ___ Python tracker <ht

[issue32331] Fix socket.type on Linux

2017-12-18 Thread Yury Selivanov
Yury Selivanov added the comment: > But I would prefer to avoid a syscall just to clear flags :-/ Yes, that's what I want to do. We control what constants the socket module exports. Let's just clear them if we export them -- that's a good working solution (and also

[issue32331] Fix socket.type on Linux

2017-12-18 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 9818142b1bd20243733a953fb8aa2c7be314c47c by Yury Selivanov in branch 'master': bpo-32331: Fix socket.type when SOCK_NONBLOCK is available (#4877) https://github.com/python/cpython/commit/9818142b1bd20243733a953fb8aa2c

[issue32331] Fix socket.type on Linux

2017-12-18 Thread Yury Selivanov
Yury Selivanov added the comment: I've merged the PR. Summary of the final change: 1. socket.socket(family, type, proto) constructor clears SOCK_NONBLOCK and SOCK_CLOEXEC from 'type' before assigning it to 'sock.type'. 2. socket.socket(family, SOCK_STREAM | SOCK_NO

[issue32331] Fix socket.type on OSes with SOCK_NONBLOCK

2017-12-18 Thread Yury Selivanov
Change by Yury Selivanov : -- title: Fix socket.type on Linux -> Fix socket.type on OSes with SOCK_NONBLOCK ___ Python tracker <https://bugs.python.org/issu

[issue32331] Fix socket.type on OSes with SOCK_NONBLOCK

2017-12-18 Thread Yury Selivanov
Yury Selivanov added the comment: > In this case, bpo-27456 should be reopened or a new issue should be opened to > fix asyncio in Python 3.6, no? I'll make a PR to fix it in 3.7. Code in 3.6 is good. -- ___ Python trac

[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-18 Thread Yury Selivanov
Change by Yury Selivanov : -- pull_requests: +4817 ___ Python tracker <https://bugs.python.org/issue27456> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-18 Thread Yury Selivanov
Yury Selivanov added the comment: Actually, I don't think we need a deprecation period. Both methods are completely unusable now. Given: async def foo(): await asyncio.sleep(1) print('A') return 42 1. Let's try to use Task.set_result(): asy

[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-18 Thread Yury Selivanov
Yury Selivanov added the comment: About the only use case I can come up with is subclassing asyncio.Task and overriding set_result and set_exception implementations. This use case has been broken (unintentionally) in Python 3.6, when we first implemented Task in _asynciomodule.c. C Task

[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-18 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4818 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32363> ___ ___ Py

[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-19 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset a7bd64c0c01379e9b82e86ad41a301329a0775d9 by Yury Selivanov in branch 'master': bpo-27456: Simplify sock type checks (#4922) https://github.com/python/cpython/commit/a7bd64c0c01379e9b82e86ad41a301

[issue32357] Optimize asyncio.iscoroutine() and loop.create_task() for non-native coroutines

2017-12-19 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> performance ___ Python tracker <https://bugs.python

[issue32357] Optimize asyncio.iscoroutine() and loop.create_task() for non-native coroutines

2017-12-19 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset a9d7e552c72b6e9515e76a1dd4b247da86da23de by Yury Selivanov in branch 'master': bpo-32357: Optimize asyncio.iscoroutine() for non-native coroutines (#4915) https://github.com/python/cpython/commit/a9d7e552c72b6e9515e76a1dd4b247

[issue32355] Optimize asyncio.gather()

2017-12-19 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 36c2c044782997520df7fc5604742a615ccf6b17 by Yury Selivanov in branch 'master': bpo-32355: Optimize asyncio.gather() (#4913) https://github.com/python/cpython/commit/36c2c044782997520df7fc5604742a

[issue32355] Optimize asyncio.gather()

2017-12-19 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue29711] When you use stop_serving in proactor loop it's kill all listening servers

2017-12-19 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset 319c0345cdd8fddb49d235462e71883f1dd51b99 by Yury Selivanov (Julien Duponchelle) in branch 'master': bpo-29711: Fix stop_serving in proactor loop kill all listening servers (#431) https://github.com/python/cpyt

[issue29711] When you use stop_serving in proactor loop it's kill all listening servers

2017-12-19 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue29711> ___ ___

[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov
New submission from Yury Selivanov : Currently we have the following methods: * socket.settimeout(t) -- can set the socket in blocking mode, when t==0. * socket.setblocking(flag) -- sets in blocking or non-blocking mode. * socket.gettimeout() -- returns 0 when socket is in non-blocking mode

[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov
Change by Yury Selivanov : -- nosy: +asvetlov, vstinner ___ Python tracker <https://bugs.python.org/issue32373> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov
Change by Yury Selivanov : -- keywords: +patch pull_requests: +4820 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32373> ___ ___ Py

[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov
Yury Selivanov added the comment: It looks like we have a bug with 'sock.settimeout()' and non-blocking/blocking modes (or maybe this is a feature?) Currently: * to make a socket non-blocking, we call 'sock.settimeout(0)'. * to make a socket blocking, we call 'sock.

[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov
Yury Selivanov added the comment: It appears the the timeouts situation is a bit more complex. It's perfectly normal for a Python socket object to be in a "blocking" mode and for its FD to be in a non-blocking mode. Read more about this in the latest docs update to

[issue32204] async/await performance is very low

2017-12-20 Thread Yury Selivanov
Yury Selivanov added the comment: Unfortunately they will not be backported, that's against our release policies, and I can't do anything about it. You can backport them yourself and build your own CPython 3.6. That's what bigger users (e.g. Facebook/Google) of Py

<    5   6   7   8   9   10   11   12   13   14   >