Re: Exception: OverflowError in comm_notify.py on startup

[email protected] (Aaron M. Ucko)
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
I'm not sure why you didn't encounter the error earlier (perhaps the
file to monitor wasn't yet present?), but I'd suggest the following
patch:

--- bitpim-1.0.5.dfsg.1.orig/src/comm_notify.py
+++ bitpim-1.0.5.dfsg.1/src/comm_notify.py
@@ -14,6 +14,7 @@
 import signal
 import sys
 
+import ctypes
 import wx
 
 bpCOMM_NOTIFICATION_EVENT = wx.NewEventType()
@@ -98,8 +99,10 @@
         if __debug__:
             raise
         return False
-    fcntl.fcntl(_global_fd, fcntl.F_NOTIFY,
-                fcntl.DN_MODIFY|fcntl.DN_CREATE|fcntl.DN_MULTISHOT)
+    flags=fcntl.DN_MODIFY|fcntl.DN_CREATE|fcntl.DN_MULTISHOT
+    # The business with ctypes ensures that fcntl's argument fits into
+    # a C integer, which might not otherwise occur on 64-bit systems.
+    fcntl.fcntl(_global_fd, fcntl.F_NOTIFY, ctypes.c_int(flags).value)
     mainwindow.log('USB Comm Watch started')
     return True
 
(One of the flags in question is 2^31, which 64-bit builds normally
treat as positive.)

-- 
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
Finger [email protected] (NOT a valid e-mail address) for more info.

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.