[issue1644] Patch submission guidelines outdated

2007-12-17 Thread Alberto Bertogli

New submission from Alberto Bertogli:

The FAQ section 5.4, "How to submit a patch?", points to
http://www.python.org/patches/, which looks really outdated
(plus the sf page seems to be restricted to members only).

Thanks,
Alberto

--
components: Documentation
messages: 58719
nosy: albertito
severity: normal
status: open
title: Patch submission guidelines outdated

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1644>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1645] Fix socketmodule.c:sock_recvfrom_guts() comment.

2007-12-17 Thread Alberto Bertogli

New submission from Alberto Bertogli:

The comment above sock_recvfrom_guts() was copied from sock_recv_guts() and
referenced recv() and recv_into() when it should be talking about recvfrom()
and recvfrom_into().

The attached patch (against trunk) fixes it.

--
components: Library (Lib)
files: 0001-Fix-socketmodule.c-sock_recvfrom_guts-comment.patch
messages: 58720
nosy: albertito
severity: minor
status: open
title: Fix socketmodule.c:sock_recvfrom_guts() comment.
versions: Python 2.6
Added file: 
http://bugs.python.org/file8980/0001-Fix-socketmodule.c-sock_recvfrom_guts-comment.patch

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1645>
__From: Alberto Bertogli <[EMAIL PROTECTED]>
Date: Wed, 5 Dec 2007 15:53:35 -0300
Subject: [PATCH] Fix socketmodule.c:sock_recvfrom_guts() comment.

The comment above sock_recvfrom_guts() was copied from sock_recv_guts() and
referenced recv() and recv_into() when it should be talking about recvfrom()
and recvfrom_into().
---
 Modules/socketmodule.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2358,12 +2358,12 @@ See recv() for documentation about the flags.");
 
 
 /*
- * This is the guts of the recv() and recv_into() methods, which reads into a
- * char buffer.  If you have any inc/def ref to do to the objects that contain
- * the buffer, do it in the caller.  This function returns the number of bytes
- * succesfully read.  If there was an error, it returns -1.  Note that it is
- * also possible that we return a number of bytes smaller than the request
- * bytes.
+ * This is the guts of the recvfrom() and recvfrom_into() methods, which reads
+ * into a char buffer.  If you have any inc/def ref to do to the objects that
+ * contain the buffer, do it in the caller.  This function returns the number
+ * of bytes succesfully read.  If there was an error, it returns -1.  Note
+ * that it is also possible that we return a number of bytes smaller than the
+ * request bytes.
  *
  * 'addr' is a return value for the address object.  Note that you must decref
  * it yourself.
-- 
1.5.4.rc0.1096.gcd2a6

___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1646] Make socket support TIPC.

2007-12-17 Thread Alberto Bertogli

New submission from Alberto Bertogli:

TIPC (http://tipc.sf.net) is an open protocol designed for use in
clustered computer environments. It currently has an open source
implementation for Linux (>= 2.6.16), and VxWorks.

The attached patch (against trunk) adds optional Linux-only support for
TIPC in the socket module.

If you want me to make one against 3.0 or any other branch, just let me
know.

Thanks,
Alberto

--
components: Library (Lib)
files: 0002-Make-socket-support-TIPC.patch
messages: 58721
nosy: albertito
severity: normal
status: open
title: Make socket support TIPC.
versions: Python 2.6
Added file: http://bugs.python.org/file8981/0002-Make-socket-support-TIPC.patch

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1646>
______From: Alberto Bertogli <[EMAIL PROTECTED]>
Date: Wed, 5 Dec 2007 18:39:18 -0300
Subject: [PATCH] Make socket support TIPC.

TIPC (http://tipc.sf.net) is an open protocol designed for use in
clustered computer environments. It currently has an open source
implementation for Linux (>= 2.6.16), and VxWorks.

This patch adds optional Linux-only support for TIPC in the socket module.
---
 Modules/socketmodule.c |  154 +++-
 Modules/socketmodule.h |4 +
 configure.in   |2 +-
 3 files changed, 158 insertions(+), 2 deletions(-)

diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -7,7 +7,8 @@ This module provides an interface to Berkeley socket IPC.
 Limitations:
 
 - Only AF_INET, AF_INET6 and AF_UNIX address families are supported in a
-  portable manner, though AF_PACKET and AF_NETLINK are supported under Linux.
+  portable manner, though AF_PACKET, AF_NETLINK and AF_TIPC are supported
+  under Linux.
 - No read/write operations (use sendall/recv or makefile instead).
 - Additional restrictions apply on some non-Unix platforms (compensated
   for by socket.py).
@@ -52,6 +53,25 @@ Module interface:
   the Ethernet protocol number to be received. For example:
   ("eth0",0x1234).  Optional 3rd,4th,5th elements in the tuple
   specify packet-type and ha-type/addr.
+- an AF_TIPC socket address is expressed as
+ (addr_type, v1, v2, v3 [, scope]); where addr_type can be one of:
+	TIPC_ADDR_NAMESEQ, TIPC_ADDR_NAME, and TIPC_ADDR_ID;
+  and scope can be one of:
+	TIPC_ZONE_SCOPE, TIPC_CLUSTER_SCOPE, and TIPC_NODE_SCOPE.
+  The meaning of v1, v2 and v3 depends on the value of addr_type:
+	if addr_type is TIPC_ADDR_NAME:
+		v1 is the server type
+		v2 is the port identifier
+		v3 is ignored
+	if addr_type is TIPC_ADDR_NAMESEQ:
+		v1 is the server type
+		v2 is the lower port number
+		v3 is the upper port number
+	if addr_type is TIPC_ADDR_ID:
+		v1 is the node
+		v2 is the ref
+		v3 is ignored
+
 
 Local naming conventions:
 
@@ -1094,6 +1114,39 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
 	}
 #endif
 
+#ifdef HAVE_LINUX_TIPC_H
+	case AF_TIPC:
+	{
+		struct sockaddr_tipc *a = (struct sockaddr_tipc *) addr;
+		if (a->addrtype == TIPC_ADDR_NAMESEQ) {
+			return Py_BuildValue("I",
+	a->addrtype,
+	a->addr.nameseq.type,
+	a->addr.nameseq.lower,
+	a->addr.nameseq.upper,
+	a->scope);
+		} else if (a->addrtype == TIPC_ADDR_NAME) {
+			return Py_BuildValue("I",
+	a->addrtype,
+	a->addr.name.name.type,
+	a->addr.name.name.instance,
+	a->addr.name.name.instance,
+	a->scope);
+		} else if (a->addrtype == TIPC_ADDR_ID) {
+			return Py_BuildValue("I",
+	a->addrtype,
+	a->addr.id.node,
+	a->addr.id.ref,
+	0,
+	a->scope);
+		} else {
+			PyErr_SetString(PyExc_TypeError,
+	"Invalid address type");
+			return NULL;
+		}
+	}
+#endif
+
 	/* More cases here... */
 
 	default:
@@ -1379,6 +1432,56 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
 	}
 #endif
 
+#ifdef HAVE_LINUX_TIPC_H
+	case AF_TIPC:
+	{
+		unsigned int atype, v1, v2, v3;
+		unsigned int scope = TIPC_CLUSTER_SCOPE;
+		struct sockaddr_tipc *addr;
+
+		if (!PyTuple_Check(args)) {
+			PyErr_Format(
+PyExc_TypeError,
+"getsockaddrarg: "
+"AF_TIPC address must be tuple, not %.500s",
+Py_Type(args)->tp_name);
+			return 0;
+		}
+
+		if (!PyArg_ParseTuple(args,
+	"|I;Invalid TIPC address format",
+	&atype, &v1, &v2, &v3, &scope))
+			return 0;
+
+		addr = (struct sockaddr_tipc *) addr_ret;
+		memset(addr, 0, sizeof(struct sockaddr_tipc));
+
+		addr->family = AF_TIPC;
+		addr->scope = scope;
+		addr->addrtype = atype;
+
+		if (atype == TIPC_ADDR_NAMESEQ) {
+			addr->addr.nameseq.type = v1;
+			addr->addr.nameseq.lower = v2;
+			addr->addr.nameseq.upper = v3;
+		} else if (atype == TIPC_ADDR_NAME) {
+			

[issue1646] Make socket support TIPC.

2007-12-19 Thread Alberto Bertogli

Alberto Bertogli added the comment:

On Tue, Dec 18, 2007 at 07:10:39PM -, Guido van Rossum wrote:
> Guido van Rossum added the comment:
> 
> I'm okay with adding this, it doesn't add much code and is properly
> safeguarded by #ifdefs and has a configure.in patch.

Thanks!

Is there anything else I need to do in order to get this ready for
inclusion?

Thanks again,
Alberto

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1646>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1646] Make socket support TIPC.

2008-01-06 Thread Alberto Bertogli

Alberto Bertogli added the comment:

On Sat, Jan 05, 2008 at 10:08:15PM -, Christian Heimes wrote:
> I'm still waiting for a new patch. Your feature patch has been accepted
> but I won't commit it without doc updates.

I know, but holidays were not the best time to write documentation.

I'll probably send you the updated patch sometime this week; thanks for
the ping =)

Thanks,
Alberto

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1646>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1646] Make socket support TIPC.

2008-01-07 Thread Alberto Bertogli

Alberto Bertogli added the comment:

On Sun, Jan 06, 2008 at 02:45:35PM -, Alberto Bertogli wrote:
> I'll probably send you the updated patch sometime this week; thanks for
> the ping =)

Here are the three patches, rebased to the SVN commit 59815.

The first one is the same I've already submitted, the second adds the
documentation and the third two testcases.

The testcases are simple, but I think cover a reasonable amount of TIPC
specific code. If you want more, let me know.

The documentation is simple, as you told me, just a paragraph explaining
about the address format and another explaining the constants. Again, if
you want me to change anything, just let me know.

Finally, if you want me to rebase this on top of any other branch, you
guessed it, just let me know ;)

Thanks a lot,
Alberto

Added file: http://bugs.python.org/file9092/0001-Make-socket-support-TIPC.patch
Added file: 
http://bugs.python.org/file9093/0002-Add-documentation-and-Misc-NEWS-entry-for-TIPC-suppo.patch
Added file: 
http://bugs.python.org/file9094/0003-Add-unit-tests-for-TIPC-socket-support.patch

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1646>
__>From b643e5cad1f4fe32ed03847bd2e55bbae76b5e8b Mon Sep 17 00:00:00 2001
From: Alberto Bertogli <[EMAIL PROTECTED]>
Date: Wed, 5 Dec 2007 18:39:18 -0300
Subject: [PATCH] Make socket support TIPC.

TIPC (http://tipc.sf.net) is an open protocol designed for use in
clustered computer environments. It currently has an open source
implementation for Linux (>= 2.6.16), and VxWorks.

This patch adds optional Linux-only support for TIPC in the socket module.
---
 Modules/socketmodule.c |  154 +++-
 Modules/socketmodule.h |4 +
 configure.in   |2 +-
 3 files changed, 158 insertions(+), 2 deletions(-)

diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index c30f1b3..e3f81db 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -7,7 +7,8 @@ This module provides an interface to Berkeley socket IPC.
 Limitations:
 
 - Only AF_INET, AF_INET6 and AF_UNIX address families are supported in a
-  portable manner, though AF_PACKET and AF_NETLINK are supported under Linux.
+  portable manner, though AF_PACKET, AF_NETLINK and AF_TIPC are supported
+  under Linux.
 - No read/write operations (use sendall/recv or makefile instead).
 - Additional restrictions apply on some non-Unix platforms (compensated
   for by socket.py).
@@ -52,6 +53,25 @@ Module interface:
   the Ethernet protocol number to be received. For example:
   ("eth0",0x1234).  Optional 3rd,4th,5th elements in the tuple
   specify packet-type and ha-type/addr.
+- an AF_TIPC socket address is expressed as
+ (addr_type, v1, v2, v3 [, scope]); where addr_type can be one of:
+   TIPC_ADDR_NAMESEQ, TIPC_ADDR_NAME, and TIPC_ADDR_ID;
+  and scope can be one of:
+   TIPC_ZONE_SCOPE, TIPC_CLUSTER_SCOPE, and TIPC_NODE_SCOPE.
+  The meaning of v1, v2 and v3 depends on the value of addr_type:
+   if addr_type is TIPC_ADDR_NAME:
+   v1 is the server type
+   v2 is the port identifier
+   v3 is ignored
+   if addr_type is TIPC_ADDR_NAMESEQ:
+   v1 is the server type
+   v2 is the lower port number
+   v3 is the upper port number
+   if addr_type is TIPC_ADDR_ID:
+   v1 is the node
+   v2 is the ref
+   v3 is ignored
+
 
 Local naming conventions:
 
@@ -1094,6 +1114,39 @@ makesockaddr(int sockfd, struct sockaddr *addr, int 
addrlen, int proto)
}
 #endif
 
+#ifdef HAVE_LINUX_TIPC_H
+   case AF_TIPC:
+   {
+   struct sockaddr_tipc *a = (struct sockaddr_tipc *) addr;
+   if (a->addrtype == TIPC_ADDR_NAMESEQ) {
+   return Py_BuildValue("I",
+   a->addrtype,
+   a->addr.nameseq.type,
+   a->addr.nameseq.lower,
+   a->addr.nameseq.upper,
+   a->scope);
+   } else if (a->addrtype == TIPC_ADDR_NAME) {
+   return Py_BuildValue("I",
+   a->addrtype,
+   a->addr.name.name.type,
+   a->addr.name.name.instance,
+   a->addr.name.name.instance,
+   a->scope);
+   } else if (a->addrtype == TIPC_ADDR_ID) {
+   return Py_BuildValue("I",
+   a->addrtype,
+   a->addr.id.node,
+  

[issue1646] Make socket support TIPC.

2008-01-07 Thread Alberto Bertogli

Alberto Bertogli added the comment:

On Mon, Jan 07, 2008 at 03:37:54PM -, Christian Heimes wrote:
> The unit tests don't work for me (Ubuntu 7.10, Linux 2.6.22, i386)
> 
> >>> srv = socket.socket(socket.AF_TIPC, socket.SOCK_RDM)
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/home/heimes/dev/python/trunk/Lib/socket.py", line 177, in __init__
> _sock = _realsocket(family, type, proto)
> socket.error: [Errno 97] Address family not supported by protocol
> 
> Do I have to set up my network device for TIPC?

No, by default you have a single-node cluster fully capable of TIPC
networking. But you do need the TIPC module loaded; have you tried
modprobe tipc?

If that works, the test cases should pass.

I understand that this might be a problem because there is no time to
check at runtime if you have TIPC enabled in your kernel (besides the
obvious way of trying to create the socket and see if it fails); but you
have the same problem with any network protocol (although obviously is
much more common to have TIPC disabled than the rest of the supported
ones).

Do you want me to check for this in the conditional for inclusion?

Thanks,
Alberto

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1646>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com