python, OS X, and fcntl

Steven D. Majewski sdm7g at Virginia.EDU
Mon Mar 26 16:14:36 EST 2001


On 26 Mar 2001, Johann Hibschman wrote:

> Hi folks,
> 
> I'm having trouble with the fcntl module under Mac OS X.  It
> sounds like this is an old problem that has resurfaced, since I can
> only find references to it in 1999 archives about OS X Server.
> Is there a known workaround?
> 
> I get, while running test_fcntl:
> 
> Status from fnctl with O_NONBLOCK:  0
> struct.pack:  '\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
> Traceback (most recent call last):
>   File "test_fcntl.py", line 31, in ?
>     rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW, lockdata)
> 
> Any hints?
> 

Somebody mentioned this in one of the mailing lists.
This was working under public beta. 

The problem line (in test/test_fcntl.py) is:

if sys.platform in ('netbsd1', 'Darwin1.2',
                    'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5',
                    'bsdos2', 'bsdos3', 'bsdos4',
                    'openbsd', 'openbsd2'):


The final release (and the early developer release candidate) are
bumped up to 1.3:

[localhost:~] sdm7g% uname -a
Darwin localhost 1.3 Darwin Kernel Version 1.3: Thu Mar  1 06:56:40 PST
2001; root:xnu/xnu-123.5.obj~1/RELEASE_PPC  Power Macintosh powerpc


*AND* something else has changed in Python 2.1 beta in parsing the 
system info in sys.platform: 

Python 2.1b2 (#1, 03/23/01, 20:07:45) 
[GCC Apple DevKit-based CPP 6.0alpha] on darwin1
Type "copyright", "credits" or "license" for more information.
>>> import sys  
>>> sys.platform
'darwin1'


So, the wrong branch gets taken and test_fcntl uses the wrong
format for the lock data. 


My guess is that we *don't* want the minor number in the sys.platform
string (the current behaviour), because it will break again on a new
release, so the test in test_fcntl.py ought to be changed to 'darwin1'.
 

-- Steve Majewski





More information about the Python-list mailing list