Merged revisions 85586-85587,85596-85598 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85586 | gregory.p.smith | 2010-10-16 17:17:24 -0700 (Sat, 16 Oct 2010) | 2 lines

  fix for netbsd.
........
  r85587 | gregory.p.smith | 2010-10-16 17:43:10 -0700 (Sat, 16 Oct 2010) | 3 lines

  applying netbsd-wizs-mod.patch from issue5510 -
   fixes for netbsd (and dragonflybsd?)
........
  r85596 | gregory.p.smith | 2010-10-16 19:14:36 -0700 (Sat, 16 Oct 2010) | 6 lines

  Fix multiprocessing Semaphore's on netbsd5. SEM_VALUE_MAX is defined
  as (~0U) on NetBSD which was causing it to appear as -1 when used as
  a signed int for _multprocessing.SemLock.SEM_VALUE_MAX.  This works
  around the problem by substituting INT_MAX on systems where it appears
  negative when used as an int.
........
  r85597 | gregory.p.smith | 2010-10-16 19:57:19 -0700 (Sat, 16 Oct 2010) | 2 lines

  skip test_itimer_virtual on NetBSD to prevent the test suite from hanging.
........
  r85598 | gregory.p.smith | 2010-10-16 20:09:12 -0700 (Sat, 16 Oct 2010) | 2 lines

  Avoid hanging the test on netbsd5.
........
This commit is contained in:
Gregory P. Smith 2010-10-17 04:28:14 +00:00
parent 6913cb0373
commit 886a1cd7dc
5 changed files with 46 additions and 9 deletions

View File

@ -438,8 +438,8 @@ class ItimerTest(unittest.TestCase):
self.assertEqual(self.hndl_called, True) self.assertEqual(self.hndl_called, True)
# Issue 3864. Unknown if this affects earlier versions of freebsd also. # Issue 3864. Unknown if this affects earlier versions of freebsd also.
@unittest.skipIf(sys.platform=='freebsd6', @unittest.skipIf(sys.platform in ('freebsd6', 'netbsd5'),
'itimer not reliable (does not mix well with threading) on freebsd6') 'itimer not reliable (does not mix well with threading) on some BSDs.')
def test_itimer_virtual(self): def test_itimer_virtual(self):
self.itimer = signal.ITIMER_VIRTUAL self.itimer = signal.ITIMER_VIRTUAL
signal.signal(signal.SIGVTALRM, self.sig_vtalrm) signal.signal(signal.SIGVTALRM, self.sig_vtalrm)

View File

@ -351,8 +351,10 @@ class GeneralModuleTests(unittest.TestCase):
# Find one service that exists, then check all the related interfaces. # Find one service that exists, then check all the related interfaces.
# I've ordered this by protocols that have both a tcp and udp # I've ordered this by protocols that have both a tcp and udp
# protocol, at least for modern Linuxes. # protocol, at least for modern Linuxes.
if sys.platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', if (sys.platform.startswith('linux') or
'freebsd7', 'freebsd8', 'darwin'): sys.platform.startswith('freebsd') or
sys.platform.startswith('netbsd') or
sys.platform == 'darwin'):
# avoid the 'echo' service on this platform, as there is an # avoid the 'echo' service on this platform, as there is an
# assumption breaking non-standard port/protocol entry # assumption breaking non-standard port/protocol entry
services = ('daytime', 'qotd', 'domain') services = ('daytime', 'qotd', 'domain')

View File

@ -471,7 +471,8 @@ class ThreadJoinOnShutdown(BaseTestCase):
return return
# Skip platforms with known problems forking from a worker thread. # Skip platforms with known problems forking from a worker thread.
# See http://bugs.python.org/issue3863. # See http://bugs.python.org/issue3863.
if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'os2emx'): if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5',
'os2emx'):
print >>sys.stderr, ('Skipping test_3_join_in_forked_from_thread' print >>sys.stderr, ('Skipping test_3_join_in_forked_from_thread'
' due to known OS bugs on'), sys.platform ' due to known OS bugs on'), sys.platform
return return

View File

@ -256,8 +256,19 @@ init_multiprocessing(void)
if (PyType_Ready(&SemLockType) < 0) if (PyType_Ready(&SemLockType) < 0)
return; return;
Py_INCREF(&SemLockType); Py_INCREF(&SemLockType);
PyDict_SetItemString(SemLockType.tp_dict, "SEM_VALUE_MAX", {
Py_BuildValue("i", SEM_VALUE_MAX)); PyObject *py_sem_value_max;
/* Some systems define SEM_VALUE_MAX as an unsigned value that
* causes it to be negative when used as an int (NetBSD). */
if ((int)(SEM_VALUE_MAX) < 0)
py_sem_value_max = PyLong_FromLong(INT_MAX);
else
py_sem_value_max = PyLong_FromLong(SEM_VALUE_MAX);
if (py_sem_value_max == NULL)
return NULL;
PyDict_SetItemString(SemLockType.tp_dict, "SEM_VALUE_MAX",
py_sem_value_max);
}
PyModule_AddObject(module, "SemLock", (PyObject*)&SemLockType); PyModule_AddObject(module, "SemLock", (PyObject*)&SemLockType);
#endif #endif

View File

@ -379,7 +379,7 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
#define SOCKETCLOSE close #define SOCKETCLOSE close
#endif #endif
#if (defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H)) && !defined(__NetBSD__) #if (defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H)) && !defined(__NetBSD__) && !defined(__DragonFly__)
#define USE_BLUETOOTH 1 #define USE_BLUETOOTH 1
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
#define BTPROTO_L2CAP BLUETOOTH_PROTO_L2CAP #define BTPROTO_L2CAP BLUETOOTH_PROTO_L2CAP
@ -393,11 +393,13 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
#define _BT_L2_MEMB(sa, memb) ((sa)->l2cap_##memb) #define _BT_L2_MEMB(sa, memb) ((sa)->l2cap_##memb)
#define _BT_RC_MEMB(sa, memb) ((sa)->rfcomm_##memb) #define _BT_RC_MEMB(sa, memb) ((sa)->rfcomm_##memb)
#define _BT_HCI_MEMB(sa, memb) ((sa)->hci_##memb) #define _BT_HCI_MEMB(sa, memb) ((sa)->hci_##memb)
#elif defined(__NetBSD__) #elif defined(__NetBSD__) || defined(__DragonFly__)
#define sockaddr_l2 sockaddr_bt #define sockaddr_l2 sockaddr_bt
#define sockaddr_rc sockaddr_bt #define sockaddr_rc sockaddr_bt
#define sockaddr_hci sockaddr_bt #define sockaddr_hci sockaddr_bt
#define sockaddr_sco sockaddr_bt #define sockaddr_sco sockaddr_bt
#define SOL_HCI BTPROTO_HCI
#define HCI_DATA_DIR SO_HCI_DIRECTION
#define _BT_L2_MEMB(sa, memb) ((sa)->bt_##memb) #define _BT_L2_MEMB(sa, memb) ((sa)->bt_##memb)
#define _BT_RC_MEMB(sa, memb) ((sa)->bt_##memb) #define _BT_RC_MEMB(sa, memb) ((sa)->bt_##memb)
#define _BT_HCI_MEMB(sa, memb) ((sa)->bt_##memb) #define _BT_HCI_MEMB(sa, memb) ((sa)->bt_##memb)
@ -1076,9 +1078,13 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
case BTPROTO_HCI: case BTPROTO_HCI:
{ {
struct sockaddr_hci *a = (struct sockaddr_hci *) addr; struct sockaddr_hci *a = (struct sockaddr_hci *) addr;
#if defined(__NetBSD__) || defined(__DragonFly__)
return makebdaddr(&_BT_HCI_MEMB(a, bdaddr));
#else
PyObject *ret = NULL; PyObject *ret = NULL;
ret = Py_BuildValue("i", _BT_HCI_MEMB(a, dev)); ret = Py_BuildValue("i", _BT_HCI_MEMB(a, dev));
return ret; return ret;
#endif
} }
#if !defined(__FreeBSD__) #if !defined(__FreeBSD__)
@ -1362,12 +1368,25 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
case BTPROTO_HCI: case BTPROTO_HCI:
{ {
struct sockaddr_hci *addr = (struct sockaddr_hci *)addr_ret; struct sockaddr_hci *addr = (struct sockaddr_hci *)addr_ret;
#if defined(__NetBSD__) || defined(__DragonFly__)
char *straddr = PyBytes_AS_STRING(args);
_BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
if (straddr == NULL) {
PyErr_SetString(socket_error, "getsockaddrarg: "
"wrong format");
return 0;
}
if (setbdaddr(straddr, &_BT_HCI_MEMB(addr, bdaddr)) < 0)
return 0;
#else
_BT_HCI_MEMB(addr, family) = AF_BLUETOOTH; _BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
if (!PyArg_ParseTuple(args, "i", &_BT_HCI_MEMB(addr, dev))) { if (!PyArg_ParseTuple(args, "i", &_BT_HCI_MEMB(addr, dev))) {
PyErr_SetString(socket_error, "getsockaddrarg: " PyErr_SetString(socket_error, "getsockaddrarg: "
"wrong format"); "wrong format");
return 0; return 0;
} }
#endif
*len_ret = sizeof *addr; *len_ret = sizeof *addr;
return 1; return 1;
} }
@ -4644,9 +4663,13 @@ init_socket(void)
PyModule_AddIntConstant(m, "BTPROTO_L2CAP", BTPROTO_L2CAP); PyModule_AddIntConstant(m, "BTPROTO_L2CAP", BTPROTO_L2CAP);
PyModule_AddIntConstant(m, "BTPROTO_HCI", BTPROTO_HCI); PyModule_AddIntConstant(m, "BTPROTO_HCI", BTPROTO_HCI);
PyModule_AddIntConstant(m, "SOL_HCI", SOL_HCI); PyModule_AddIntConstant(m, "SOL_HCI", SOL_HCI);
#if !defined(__NetBSD__) && !defined(__DragonFly__)
PyModule_AddIntConstant(m, "HCI_FILTER", HCI_FILTER); PyModule_AddIntConstant(m, "HCI_FILTER", HCI_FILTER);
#endif
#if !defined(__FreeBSD__) #if !defined(__FreeBSD__)
#if !defined(__NetBSD__) && !defined(__DragonFly__)
PyModule_AddIntConstant(m, "HCI_TIME_STAMP", HCI_TIME_STAMP); PyModule_AddIntConstant(m, "HCI_TIME_STAMP", HCI_TIME_STAMP);
#endif
PyModule_AddIntConstant(m, "HCI_DATA_DIR", HCI_DATA_DIR); PyModule_AddIntConstant(m, "HCI_DATA_DIR", HCI_DATA_DIR);
PyModule_AddIntConstant(m, "BTPROTO_SCO", BTPROTO_SCO); PyModule_AddIntConstant(m, "BTPROTO_SCO", BTPROTO_SCO);
#endif #endif