[issue33350] WinError 10038 is raised when loop.sock_connect is wrapped with asyncio.wait_for

2018-12-28 Thread Alisue Lambda


Alisue Lambda  added the comment:

https://github.com/python/asyncio/pull/419

It seems the PR above which has not merged solve the issue.

--

___
Python tracker 
<https://bugs.python.org/issue33350>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34406] Typo in documentation

2018-08-14 Thread Alisue Lambda


Change by Alisue Lambda :


--
title: Type in documentation -> Typo in documentation

___
Python tracker 
<https://bugs.python.org/issue34406>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34406] Type in documentation

2018-08-14 Thread Alisue Lambda


New submission from Alisue Lambda :

https://docs.python.org/3.8/using/windows.html#removing-the-max-path-limitation

Current
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem@LongPathsEnabled

Should be
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled

--
assignee: docs@python
components: Documentation
messages: 323527
nosy: Alisue Lambda, docs@python
priority: normal
severity: normal
status: open
title: Type in documentation
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue34406>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33350] WinError 10038 is raised when loop.sock_connect is wrapped with asyncio.wait_for

2018-08-07 Thread Alisue Lambda


Alisue Lambda  added the comment:

I use the following patch to fix the behavior in Windows.


```
import sys

if sys.platform != 'win32':
def patch():
pass
else:
def patch():
"""Patch selectors.SelectSelector to fix WinError 10038 in Windows

Ref: https://bugs.python.org/issue33350
"""

import select
from selectors import SelectSelector

def _select(self, r, w, _, timeout=None):
try:
r, w, x = select.select(r, w, w, timeout)
except OSError as e:
if hasattr(e, 'winerror') and e.winerror == 10038:
# descriptors may already be closed
return [], [], []
raise
else:
return r, w + x, []

SelectSelector._select = _select
```

--

___
Python tracker 
<https://bugs.python.org/issue33350>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33350] WinError 10038 is raised when loop.sock_connect is wrapped with asyncio.wait_for

2018-04-24 Thread Alisue Lambda

Alisue Lambda <lambdali...@hashnote.net> added the comment:

I've found an workaround. The point is that 'with s' should be included in a 
coroutine which will be timed-out.

import asyncio
import socket

ADDR = ('10.0.2.1', 22)


async def check(loop):
s = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
s.setblocking(False)
with s:
await loop.sock_connect(s, ADDR)


async def test(loop):
try:
await asyncio.wait_for(
check(loop),
timeout=3,
loop=loop,
)
except Exception as e:
print('Fail: %s' % e)
else:
print('Success')


if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(test(loop))

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33350>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33350] WinError 10038 is raised when loop.sock_connect is wrapped with asyncio.wait_for

2018-04-24 Thread Alisue Lambda

Alisue Lambda <lambdali...@hashnote.net> added the comment:

I should have mentioned that the script works well on macOS and Linux.
This issue exists only on Windows.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33350>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33350] WinError 10038 is raised when loop.sock_connect is wrapped with asyncio.wait_for

2018-04-24 Thread Alisue Lambda

New submission from Alisue Lambda <lambdali...@hashnote.net>:

This is my first time to create an issue on the python bug tracker so let me 
know if I don't follow the rule which I need to follow.

# Summary

Using 'loop.sock_connect' with 'asyncio.wait_for' raises 'OSError [WinError 
10038]' in Windows 10 Pro when timed-out.

# Detail

I use 'loop.sock_connect' to establish a TCP connection for checking if a 
particular port on a target host is available.
However, when I wrap the coroutine with 'asyncio.wait_for', the following 
exception is raised when the wrapped coroutine has timed-out.

Traceback (most recent call last):
  File "C:\Users\alisue/test.py", line 41, in 
loop.run_until_complete(test(loop))
  File "C:\Python36\lib\asyncio\base_events.py", line 454, in 
run_until_complete
self.run_forever()
  File "C:\Python36\lib\asyncio\base_events.py", line 421, in run_forever
self._run_once()
  File "C:\Python36\lib\asyncio\base_events.py", line 1395, in _run_once
event_list = self._selector.select(timeout)
  File "C:\Python36\lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
  File "C:\Python36\lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] ...

While it is raised from 'lib\selectors.py', I cannot catch this exception so 
the event loop has halted.

The attached 'test.py' is a minimum script to reproduce the error.

Thanks.

------
components: asyncio
files: test.py
messages: 315707
nosy: Alisue Lambda, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: WinError 10038 is raised when loop.sock_connect is wrapped with 
asyncio.wait_for
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47548/test.py

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33350>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com