[issue1746656] IPv6 Interface naming/indexing functions
Changes by Charles-François Natali neolo...@free.fr: Removed file: http://bugs.python.org/file22025/socket_if.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Charles-François Natali neolo...@free.fr added the comment: You use UTF-8 encoding: Here's an updated patch taking your comments into account (I'm really blissfully ignorant when it comes to encoding issues, so I hope it will be OK this time). -- Added file: http://bugs.python.org/file22039/socket_if.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Gregory P. Smith g...@krypto.org added the comment: that patch looks good. though I do wish we had a function similar to PyObject_AsStringEncodedFSDefault() so that the ParseTuple call wasn't needed for this relatively common operation when interfacing with system library calls that deal in C strings. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
STINNER Victor victor.stin...@haypocalc.com added the comment: that patch looks good I tested it with non-ASCII interface names: it works as expected with ASCII and UTF-8 locales. It's the first time that I see the O format for Py_BuildValue(), I didn't know this one. The patch looks good. @neologix: You can commit it into Python 3.3. Tell me if you need help ;-) though I do wish we had a function similar to PyObject_AsStringEncodedFSDefault() so that the ParseTuple call wasn't needed for this relatively common operation when interfacing with system library calls that deal in C strings. PyUnicode_FSConverter and PyUnicode_FSDecoder don't fit your needs? What you would be the purpose of PyObject_AsStringEncodedFSDefault()? What is its prototype? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Roundup Robot devnull@devnull added the comment: New changeset cc60d0283fad by Charles-François Natali in branch 'default': Issue #1746656: make if_nameindex(), if_indextoname() and if_nametoindex() http://hg.python.org/cpython/rev/cc60d0283fad -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Charles-François Natali neolo...@free.fr added the comment: @neologix: You can commit it into Python 3.3. Tell me if you need help ;-) My first commit :-) What's the next step? Can this issue be closed, or should I wait until the tests pass on some buildbot? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Antoine Pitrou pit...@free.fr added the comment: My first commit :-) What's the next step? Can this issue be closed, or should I wait until the tests pass on some buildbot? You can close the issue nevertheless (as fixed / committed/rejected). It can be reopened later if there's a buildbot failure. (note that many 3.x buildbots are currently red for another reason :)) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Changes by Charles-François Natali neolo...@free.fr: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
STINNER Victor victor.stin...@haypocalc.com added the comment: Here's a patch: - those functions now accept and return str, not bytes arrays You use UTF-8 encoding: +Is, ni[i].if_index, ni[i].if_name); +if (!PyArg_ParseTuple(args, s:if_nametoindex, ifname)) You should also use the FS encoding with surrogateescape error handler: - parse arguments using O format with PyUnicode_FSConverter: it gives you a PyBytes object, then use PyBytes_AS_STRING() and PyBytes_GET_SIZE() - use PyUnicode_DecodeFSDefault() to decode a byte string -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
STINNER Victor victor.stin...@haypocalc.com added the comment: Example with a non-ASCII interface name: $ sudo tunctl -u haypo -t unicodeé Set 'unicodeé' persistent and owned by uid 1000 $ sudo ifconfig -a|grep unicode|hexdump -C 75 6e 69 63 6f 64 65 c3 a9 20 4c 69 6e 6b 20 65 |unicode.. Link e| 0010 6e 63 61 70 3a 45 74 68 65 72 6e 65 74 20 20 48 |ncap:Ethernet H| 0020 57 61 64 64 72 20 64 36 3a 30 38 3a 31 63 3a 65 |Waddr d6:08:1c:e| 0030 30 3a 33 33 3a 30 36 20 20 0a|0:33:06 .| 003a So in my setup (UTF-8 locale encoding), U+00E9 is encoded as {0xc3, 0xa9} (UTF-8). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Charles-François Natali neolo...@free.fr added the comment: Here's a patch: - those functions now accept and return str, not bytes arrays - some of them were not declared static, it's now fixed - use PyErr_SetFromErrno when errno is set - add tests (return type, nonexistent interface name/index and invalid argument) - cleanup Note that I'm not sure about my char * - PyObject conversions, encoding/unicode issues are really something I'm completely oblivious to. -- nosy: +neologix Added file: http://bugs.python.org/file22025/socket_if.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Changes by Santoso Wijaya santoso.wij...@gmail.com: -- nosy: +santa4nt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Antoine Pitrou pit...@free.fr added the comment: Sorry to reopen, but do these methods really have to return *byte strings* for interface names? In Python 3, we usually take the position that textually meaningful data should be str, not bytes (even filenames under POSIX). The usual way to do this is to use the filesystem encoding (os.fsdecode in pure Python, PyUnicode_DecodeFSDefault in C). Also, the tests are really minimal. They should at least check the type and structure of values returned by these functions. -- nosy: +pitrou status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Roundup Robot devnull@devnull added the comment: New changeset c2515cb23d9b by Gregory P. Smith in branch 'default': Issue #1746656: Add if_nameindex, if_nametoindex, if_indextoname http://hg.python.org/cpython/rev/c2515cb23d9b -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Gregory P. Smith g...@krypto.org added the comment: I added these with conditional compilation via autoconf for use on posix systems. These methods are not IPv6 specific. Anyone who wants to see them supported on windows will need to add whatever conditional compilation magic is required to enable that on appropriate builds. -- resolution: - fixed stage: test needed - committed/rejected status: open - closed versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
STINNER Victor victor.stin...@haypocalc.com added the comment: New changeset c2515cb23d9b by Gregory P. Smith in branch 'default': Issue #1746656: Add if_nameindex, if_nametoindex, if_indextoname The _socket module doesn't compile on OpenIndiana anymore: http://www.python.org/dev/buildbot/all/builders/AMD64%20OpenIndiana%203.x/builds/1207/steps/test/logs/stdio -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
STINNER Victor victor.stin...@haypocalc.com added the comment: The _socket module doesn't compile on OpenIndiana anymore Same problem of FreeBSD 8.2: http://www.python.org/dev/buildbot/all/builders/AMD64%20FreeBSD%208.2%203.x/builds/291/steps/test/logs/stdio -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Nadeem Vawda nadeem.va...@gmail.com added the comment: Also failing to compile on OS X: http://www.python.org/dev/buildbot/all/builders/AMD64%20Leopard%203.x/builds/1385/steps/test/logs/stdio The problem seems to be that net/if.h is not being included on these non-Linux systems. Looking at Modules/socketmodule.h reveals that its inclusion is conditional on HAVE_NETPACKET_PACKET_H: #ifdef HAVE_NETPACKET_PACKET_H # include sys/ioctl.h # include net/if.h # include netpacket/packet.h #endif Changing it to something like this should solve the problem: #ifdef HAVE_NET_IF_H # include net/if.h #endif #ifdef HAVE_NETPACKET_PACKET_H # include sys/ioctl.h # include netpacket/packet.h #endif -- nosy: +nadeem.vawda ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Roundup Robot devnull@devnull added the comment: New changeset 434dfe42fde1 by Nadeem Vawda in branch 'default': Fix _socket compilation failures on non-Linux buildbots (cf. issue #1746656). http://hg.python.org/cpython/rev/434dfe42fde1 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Nadeem Vawda nadeem.va...@gmail.com added the comment: The OpenIndiana bots are now green, but the BSD and OS X bots are still failing. It seems that on those systems, net/if.h depends on sys/types.h and maybe some other headers, so the current configure script detects it as present but not usable. I'm currently setting up a FreeBSD VM so I can poke around and figure out what the missing dependencies are. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Gregory P. Smith g...@krypto.org added the comment: thanks i'll take a look at OS X here. obviously i did development and testing on linux. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Nadeem Vawda nadeem.va...@gmail.com added the comment: OK, that's great. It'll be another couple of hours before I can do anything from the FreeBSD side; I'm still waiting for the ISO to finish downloading :/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Roundup Robot devnull@devnull added the comment: New changeset b6aafb20e5f5 by Gregory P. Smith in branch 'default': issue #1746656: Fix for OS X. configure and #include changes so that the socket http://hg.python.org/cpython/rev/b6aafb20e5f5 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Nadeem Vawda nadeem.va...@gmail.com added the comment: All the buildbots are back to normal. It looks like FreeBSD was having the same problem as OS X. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.2 -Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Gregory P. Smith g...@krypto.org added the comment: What is the status of these methods? On the windows side, it appears that these are only available in Vista and later so we'll need some conditional compliation magic there: http://msdn.microsoft.com/en-us/library/bb408409(VS.85).aspx fyi - the implementation can be simplified by using Py_BuildValue(). -- assignee: - gregory.p.smith nosy: +gregory.p.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Changes by Daniel Diniz aja...@gmail.com: -- stage: - test needed versions: +Python 2.7, Python 3.1 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1746656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Christian Heimes added the comment: How do you know that the patch is working when you don't know how to test it? Nobody is going to apply new features without unit tests. -- nosy: +tiran _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1746656 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Changes by Gabriel de Perthuis : -- nosy: +onyxg7 type: - rfe _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1746656 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com