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
socket: AF_UNIX socket paths not handled according to PEP 383 #52620
Comments
In 3.x, the socket module assumes that AF_UNIX addresses use Python 3.1.2 (r312:79147, Mar 23 2010, 19:02:21)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> from socket import *
>>> s = socket(AF_UNIX, SOCK_STREAM)
>>> s.bind(b"\xff")
>>> s.getsockname()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: unexpected code byte I'm attaching a patch to handle socket paths according to PEP-383. Normally this would use PyUnicode_FSConverter, but there One is that embedded null bytes are passed through to the system The current code also accepts read-only buffer objects (it uses This patch applies on top of the patches I submitted for issue |
This patch does the same thing without fixing issue bpo-8372 (not |
Updated the patches for Python 3.2 - these are now simpler as I've put the docs and tests in one patch, and made separate One point I neglected to comment on before is the ability to |
One of the tests got broken by the removal of sys.setfilesystemencoding(). Replaced it. |
New changeset 1f23bb74f4bc by Antoine Pitrou in branch 'default': |
Patch committed in 3.3 (default branch), thank you! |
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: