Title: socket address slice issue
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: mb_, santa4nt, zyasoft
Priority: Keywords: patch

Created on 2014-05-28.19:20:10 by mb_, last changed 2014-06-25.16:02:04 by zyasoft.

File name Uploaded Description Edit Remove mb_, 2014-05-28.19:20:08
issue2155.patch santa4nt, 2014-05-29.03:57:56 Make tuple-like object returned by getaddrinfo() behave more like a tuple.
issue2155.patch santa4nt, 2014-05-29.04:11:34 Patch refresh.
msg8582 (view) Author: Michael B├╝sch (mb_) Date: 2014-05-28.19:20:08
The attached script '' shows different behavior between Jython 2.7 hg and CPython 2.7.7rc1:

> $ python2 ./ 
> ('', 80)
> $ /home/mb/develop/hg/jython/dist/bin/jython ./ 
> Traceback (most recent call last):
>   File "./", line 4, in <module>
>     print sockaddr[:2]
>   File "/home/mb/develop/hg/jython/dist/Lib/", line 1408, in __getitem__
>     raise IndexError()
> IndexError
msg8585 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-05-29.01:05:56
This is because the old-style classes _ipv4_address_t and _ipv6_address_t returned by getaddrinfo() do not support slicing.
msg8586 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-05-29.03:57:55
Simple enough to patch.
msg8660 (view) Author: Jim Baker (zyasoft) Date: 2014-06-17.22:59:38
Just need to add corresponding tests to the work that Santoso has done; then merge this in.
msg8661 (view) Author: Jim Baker (zyasoft) Date: 2014-06-17.23:01:09
Sorry, Santoso has a test inspired by this example, so it's ready to merge in.
msg8666 (view) Author: Jim Baker (zyasoft) Date: 2014-06-18.17:39:13
Fixed in
Date User Action Args
2014-06-25 16:02:04zyasoftsetstatus: pending -> closed
2014-06-18 17:39:13zyasoftsetstatus: open -> pending
resolution: fixed
messages: + msg8666
2014-06-17 23:01:09zyasoftsetmessages: + msg8661
2014-06-17 22:59:39zyasoftsetnosy: + zyasoft
messages: + msg8660
2014-05-29 04:11:34santa4ntsetfiles: + issue2155.patch
2014-05-29 03:57:56santa4ntsetfiles: + issue2155.patch
keywords: + patch
messages: + msg8586
2014-05-29 01:05:57santa4ntsetnosy: + santa4nt
messages: + msg8585
2014-05-28 19:20:10mb_create