Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue1114] _curses issues on 64-bit big-endian (e.g, AIX)

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Sep 5, 2007, 8:32 PM

Post #1 of 4 (274 views)
Permalink
[issue1114] _curses issues on 64-bit big-endian (e.g, AIX)

New submission from Luke Mewburn:

Attempting to use curses attributes with python 2.3.5 on AIX (64bit
powerpc) doesn't work, and occasionally results in exceptions being raised.

_cursesmodule.c assumes that attr_t is a `long' and uses the "l"
decoding of PyArg_ParseTuple() to read values from python to C. On
platforms where sizeof(int) == sizeof(long), this isn't a problem.
However, on LP64, especially big-endian LP64, this results in the wrong
value being stored in the target address.

My solution is to use ParseTuple("l") into a variable with an explicit
type of 'long', and then assign that to the attr_t variable that the
underlying curses(3) functions are called with.

(I don't know if there's a different convention for dealing with reading
numbers from python into underlying C types where the C type size isn't
consistently an `int' or a `long', other that reading into an explicit
int/long and then assigning/casting to the final type)

The code in question doesn't appear to have changed much between python
2.3.5 and the svn trunk (as at 20070906), and my patch for the former
applied fairly cleanly to my checkout of the latter. I've attached a
diff from the svn checkout.

----------
components: Extension Modules
files: curses-attr_t-long.diff
messages: 55675
nosy: lukemewburn
severity: normal
status: open
title: _curses issues on 64-bit big-endian (e.g, AIX)
type: behavior
versions: Python 2.3

__________________________________
Tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue1114>
__________________________________
Attachments: curses-attr_t-long.diff (9.90 KB)


report at bugs

Sep 5, 2007, 8:32 PM

Post #2 of 4 (249 views)
Permalink
[issue1114] _curses issues on 64-bit big-endian (e.g, AIX) [In reply to]

New submission from Luke Mewburn:

Attempting to use curses attributes with python 2.3.5 on AIX (64bit
powerpc) doesn't work, and occasionally results in exceptions being raised.

_cursesmodule.c assumes that attr_t is a `long' and uses the "l"
decoding of PyArg_ParseTuple() to read values from python to C. On
platforms where sizeof(int) == sizeof(long), this isn't a problem.
However, on LP64, especially big-endian LP64, this results in the wrong
value being stored in the target address.

My solution is to use ParseTuple("l") into a variable with an explicit
type of 'long', and then assign that to the attr_t variable that the
underlying curses(3) functions are called with.

(I don't know if there's a different convention for dealing with reading
numbers from python into underlying C types where the C type size isn't
consistently an `int' or a `long', other that reading into an explicit
int/long and then assigning/casting to the final type)

The code in question doesn't appear to have changed much between python
2.3.5 and the svn trunk (as at 20070906), and my patch for the former
applied fairly cleanly to my checkout of the latter. I've attached a
diff from the svn checkout.

----------
components: Extension Modules
files: curses-attr_t-long.diff
messages: 55675
nosy: lukemewburn
severity: normal
status: open
title: _curses issues on 64-bit big-endian (e.g, AIX)
type: behavior
versions: Python 2.3

__________________________________
Tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue1114>
__________________________________
Attachments: curses-attr_t-long.diff (9.90 KB)


report at bugs

Sep 9, 2007, 9:54 AM

Post #3 of 4 (242 views)
Permalink
[issue1114] _curses issues on 64-bit big-endian (e.g, AIX) [In reply to]

Changes by Martin v. Löwis:


----------
keywords: +patch

__________________________________
Tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue1114>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Sep 17, 2007, 2:17 AM

Post #4 of 4 (233 views)
Permalink
[issue1114] _curses issues on 64-bit big-endian (e.g, AIX) [In reply to]

Changes by Sean Reifschneider:


----------
assignee: -> akuchling
components: +Library (Lib) -Extension Modules
nosy: +akuchling
priority: -> normal

__________________________________
Tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue1114>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.