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
test_socket.testDup, testFromFd fail on Windows #53962
Comments
The errors below show up on my XP machine in Python 3.1 as well as a recent build from the py3k branch. I'm not sure why they *don't* show up on the XP buildbot. fromfd() ultimately calls dup(), so the underlying problem is likely the same for all the failures. dup() support was added for Windows in bpo-1378. ====================================================================== Traceback (most recent call last):
File "C:\Python31\lib\test\test_socket.py", line 628, in testDup
msg = sock.recv(1024)
socket.error: [Errno 10038] An operation was attempted on something that is not a socket ====================================================================== Traceback (most recent call last):
File "C:\Python31\lib\test\test_socket.py", line 619, in testFromFd
msg = sock.recv(1024)
socket.error: [Errno 10038] An operation was attempted on something that is not a socket ====================================================================== Traceback (most recent call last):
File "C:\Python31\lib\test\test_socket.py", line 628, in testDup
msg = sock.recv(1024)
socket.error: [Errno 10045] The attempted operation is not supported for the type of object referenced ====================================================================== Traceback (most recent call last):
File "C:\Python31\lib\test\test_socket.py", line 619, in testFromFd
msg = sock.recv(1024)
socket.error: [Errno 10038] An operation was attempted on something that is not a socket |
test_socket.py passes here. |
I run it the same way. I wonder what's different? :-( I will try to find some time to investigate further. |
On Windows, socket.dup is implemented using DuplicateHandle. The documentation for DuplicateHandle reads: You should not use DuplicateHandle to duplicate handles to the following objects:
|
Following the advice of DuplicateHandle's documentation, I reimplemented dup on Windows using WSADuplicateHandle. Attached is a patch. With the patch, the tests pass on my Windows machine. Would someone like to review the patch? |
The documentation of WSASocket(), and the code of PyBluez |
Thanks! Updated as you suggested and committed as r84450 and r84451. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: