[issue1789] assumption about unsigned long byte size in struct module usage

2010-06-29 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Doc patch committed in revisions r82379 through r82382.

--
status: open - closed

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



[issue1789] assumption about unsigned long byte size in struct module usage

2010-06-25 Thread Joseph Turian

Joseph Turian tur...@gmail.com added the comment:

I just got bit by this bug. This documentation 
(http://docs.python.org/library/struct.html) claims that an unsigned long is 4 
bytes. On my machine, it's 8.

--
nosy: +Joseph Turian

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



[issue1789] assumption about unsigned long byte size in struct module usage

2010-06-25 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

 This documentation (http://docs.python.org/library/struct.html)
 claims that an unsigned long is 4 bytes.

I don't think it does, if you read it closely.  Of course, patches to improve 
the docs are always welcome. :)

If you're looking at the table of format codes, note that it refers to the 
*standard* size, which is the size used when standard size and alignment are in 
effect (i.e., when the struct format string starts with '', '', etc.).  That 
standard size is indeed 4 bytes for the 'l' and 'L' codes.

--
nosy: +mark.dickinson

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



[issue1789] assumption about unsigned long byte size in struct module usage

2010-06-25 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Here's a proposed doc clarification.

--
keywords: +patch
Added file: http://bugs.python.org/file17770/issue1789_doc.patch

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



[issue1789] assumption about unsigned long byte size in struct module usage

2010-06-25 Thread Joseph Turian

Joseph Turian tur...@gmail.com added the comment:

That patch gives good clarification.

--

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



[issue1789] assumption about unsigned long byte size in struct module usage

2010-06-25 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
assignee: gregory.p.smith - mark.dickinson
status: closed - open

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



[issue1789] assumption about unsigned long byte size in struct module usage

2008-01-24 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Anders J. Munch on python-dev correctly says:

You overlooked the words Standard size and alignment are as follows
that start the quoted paragraph.  It's a little confusing because
standard size is not the default.  The default is platform-specific
sizes.  Only if you start the format string with , , ! or = do you
get standard sizes.

The reference documentation is correct as it stands, and, I suspect,
so is the LP64 implementation.  Doesn't struct.pack('l',42) produce a
4-byte string on LP64?

The tutorial at
http://docs.python.org/tut/node13.html#SECTION001330%3E
has a bug though: the format string should use ''.

I believe zipfile.py correctly uses '' throughout.

--
keywords: +easy -patch
priority: urgent - normal
severity: major - normal
versions:  -Python 2.4

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



[issue1789] assumption about unsigned long byte size in struct module usage

2008-01-24 Thread Gregory P. Smith

Gregory P. Smith added the comment:

The giant patch was unnecessary, I misread what the struct module was
actually doing.  Auditing all uses of struct in the standard library the
only ones that look suspicious to me are:

Lib/posixfile.py
and all of the uses in Lib/plat-mac/

posixfile is probably fine, but it wouldn't surprise me if there are
bugs on some platforms in there due to using 'l' to decode off_t and 'h'
to decode pid_t within a fcntl structure.

The plat-mac stuff might break assuming those APIs are even available to
64bit programs.  I'll leave that up to the mac porting folks, as it is
its difficult if not impossible to even build a 64-bit Python under OS X.

Fixed in trunk r60234.

--
resolution:  - fixed
status: open - closed

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



[issue1789] assumption about unsigned long byte size in struct module usage

2008-01-23 Thread Gregory P. Smith

Gregory P. Smith added the comment:

A significant portion of the python standard library is broken due to
incorrect use of the struct module on LP64 platforms.  I'm attaching a
patch that should clean it up.

I need Mac OS X people to confirm that the Mac changes are sane.

Its possible that the Lib/posixfile.py change could be a candidate for a
2.4 security backport if it turns out the _posixfile_.lock()
implementation is indeed broken when a 64bit python is used on some
platforms.  I'll leave that up to the 2.4 releaser to decide.

--
components: +Library (Lib)
keywords: +64bit, patch -easy
priority: normal - high
severity: normal - major
title: incorrect assumption about unsigned long byte size - assumption about 
unsigned long byte size in struct module usage
versions: +Python 2.4, Python 2.5, Python 2.6
Added file: http://bugs.python.org/file9276/struct-long-nuke-01.diff

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



[issue1789] assumption about unsigned long byte size in struct module usage

2008-01-23 Thread Georg Brandl

Changes by Georg Brandl:


--
priority: high - urgent

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