[issue8139] ossaudiodev not initializing its types
New submission from Bertrand Janin : With Python 3.1.2-rc1, here is what happens when trying to open a mixer: Python 3.1.2rc1 (r312rc1:78737, Mar 14 2010, 15:17:09) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import ossaudiodev >>> m = ossaudiodev.openmixer() >>> m.fileno() Traceback (most recent call last): File "", line 1, in AttributeError: 'ossaudiodev.oss_mixer_device' object has no attribute 'fileno' This seems to be due to the fact that the module does not initialize its types with PyType_Ready(), hence the Mixer type never gets its tp_getattro property from its parent type. I attached a small patch to fix this. -- components: Extension Modules files: ossaudiodev.c.patch keywords: patch messages: 101063 nosy: tamentis severity: normal status: open title: ossaudiodev not initializing its types type: behavior versions: Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file16547/ossaudiodev.c.patch ___ Python tracker <http://bugs.python.org/issue8139> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8139] ossaudiodev not initializing its types
Bertrand Janin added the comment: This is still an issue in Python 3.1.2 release. -- ___ Python tracker <http://bugs.python.org/issue8139> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3244] multipart/form-data encoding
Changes by Bertrand Janin : -- nosy: +tamentis ___ Python tracker <http://bugs.python.org/issue3244> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3372] socket.setsockopt() is broken for multicast TTL and Loop options
Bertrand Janin added the comment: This is still an issue as of OpenBSD 5.6. Here is an updated patch for the latest 2.7 branch: diff -r 88de50c1696b Modules/socketmodule.c --- a/Modules/socketmodule.cSun Dec 28 18:51:25 2014 +0200 +++ b/Modules/socketmodule.cSun Dec 28 21:24:41 2014 -0500 @@ -1881,24 +1881,29 @@ { int level; int optname; int res; char *buf; int buflen; int flag; if (PyArg_ParseTuple(args, "iii:setsockopt", &level, &optname, &flag)) { buf = (char *) &flag; buflen = sizeof flag; +/* Multi cast options take shorter arguments */ +if (optname == IP_MULTICAST_TTL +|| optname == IP_MULTICAST_LOOP) +buflen = sizeof(u_char); + buf = (char *) &flag; } else { PyErr_Clear(); if (!PyArg_ParseTuple(args, "iis#:setsockopt", &level, &optname, &buf, &buflen)) return NULL; } res = setsockopt(s->sock_fd, level, optname, (void *)buf, buflen); if (res < 0) return s->errorhandler(); Py_INCREF(Py_None); return Py_None; -- nosy: +tamentis versions: +Python 2.7, Python 3.4 ___ Python tracker <http://bugs.python.org/issue3372> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23127] socket.setsockopt() is still broken for multicast TTL and Loop options
New submission from Bertrand Janin: Since I can't re-open issue 3372, I'm opening a new issue. socket.setsockopt() still sets an optlen of '4' in the setsockopt() system call for options IP_MULTICAST_TTL and IP_MULTICAST_LOOP. On OpenBSD, this causes the kernel to hit an error condition and set errno 22 when these options are set: socket.error: (22, 'Invalid argument') According to both FreeBSD and OpenBSD manual pages (see e.g. http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man4/ip.4), these fields are in fact both 8 bit unsigned, and the manuals suggest the following: u_char ttl; /* range: 0 to 255, default = 1 */ setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)); The following updated patch for branch "2.7" passes a shorter "optlen" for certain Multicast options, it was tested on OpenBSD, Linux and OSX and was initially proposed by niallo: diff -r 88de50c1696b Modules/socketmodule.c --- a/Modules/socketmodule.cSun Dec 28 18:51:25 2014 +0200 +++ b/Modules/socketmodule.cMon Dec 29 08:27:24 2014 -0500 @@ -1879,26 +1879,29 @@ static PyObject * sock_setsockopt(PySocketSockObject *s, PyObject *args) { int level; int optname; int res; char *buf; int buflen; int flag; if (PyArg_ParseTuple(args, "iii:setsockopt", &level, &optname, &flag)) { +buflen = sizeof flag; +/* Multicast options take shorter arguments */ +if (optname == IP_MULTICAST_TTL || optname == IP_MULTICAST_LOOP) +buflen = sizeof(u_char); buf = (char *) &flag; -buflen = sizeof flag; } else { PyErr_Clear(); if (!PyArg_ParseTuple(args, "iis#:setsockopt", &level, &optname, &buf, &buflen)) return NULL; } res = setsockopt(s->sock_fd, level, optname, (void *)buf, buflen); if (res < 0) return s->errorhandler(); Py_INCREF(Py_None); return Py_None; -- components: Library (Lib) messages: 233174 nosy: tamentis priority: normal severity: normal status: open title: socket.setsockopt() is still broken for multicast TTL and Loop options type: behavior versions: Python 2.7, Python 3.4 ___ Python tracker <http://bugs.python.org/issue23127> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23127] socket.setsockopt() is still broken for multicast TTL and Loop options
Bertrand Janin added the comment: I don't really need it in my own software, I was trying to use https://github.com/SoCo/SoCo/ and couldn't get it working on OpenBSD. I'm sure this is a portability problem on a number of library using Multicast. Do you see something wrong with the patch? -- ___ Python tracker <http://bugs.python.org/issue23127> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23127] socket.setsockopt() is still broken for multicast TTL and Loop options
Bertrand Janin added the comment: Good point, I updated the diff with a better cast to avoid endianness issues (tested on MIPS64) and added an OpenBSD #ifdef, is that more acceptable? diff -r 88de50c1696b Modules/socketmodule.c --- a/Modules/socketmodule.cSun Dec 28 18:51:25 2014 +0200 +++ b/Modules/socketmodule.cWed Dec 31 14:25:55 2014 -0500 @@ -1881,24 +1881,31 @@ { int level; int optname; int res; char *buf; int buflen; int flag; if (PyArg_ParseTuple(args, "iii:setsockopt", &level, &optname, &flag)) { buf = (char *) &flag; buflen = sizeof flag; +#if defined(__OpenBSD__) +/* Multicast options take shorter arguments */ +if (optname == IP_MULTICAST_TTL || optname == IP_MULTICAST_LOOP) { +buflen = sizeof(u_char); +*buf = (u_char)flag; +} +#endif } else { PyErr_Clear(); if (!PyArg_ParseTuple(args, "iis#:setsockopt", &level, &optname, &buf, &buflen)) return NULL; } res = setsockopt(s->sock_fd, level, optname, (void *)buf, buflen); if (res < 0) return s->errorhandler(); Py_INCREF(Py_None); return Py_None; -- ___ Python tracker <http://bugs.python.org/issue23127> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com