[issue16934] qsort doesn't work for double arrays

2013-01-11 Thread Stephane Poirier

New submission from Stephane Poirier:

qsort doesn't sort arrays that are defined with double elements.
You can find attached a script that shows this function working well for int 
(as described in the ctypes documentation). If int array is replaced by double 
array qsort doesn't sort any more.
Even worse, with python 2.6, the difference between a[0] and b[0] may be nan.
The script can be launch by 
python.exe testQSort33.py

--
components: ctypes
files: testQSort33.py
messages: 179680
nosy: stephane.poirier
priority: normal
severity: normal
status: open
title: qsort doesn't work for double arrays
type: behavior
versions: Python 2.6, Python 2.7, Python 3.3
Added file: http://bugs.python.org/file28696/testQSort33.py

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



[issue16934] qsort doesn't work for double arrays

2013-01-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +amaury.forgeotdarc, belopolsky, meador.inge

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



[issue16934] qsort doesn't work for double arrays

2013-01-11 Thread Mark Dickinson

Mark Dickinson added the comment:

What happens if you replace the line:

CMPFUNC = CFUNCTYPE(c_double, POINTER(c_double), POINTER(c_double))

in your example code with

CMPFUNC = CFUNCTYPE(c_int, POINTER(c_double), POINTER(c_double))

?

--
nosy: +mark.dickinson

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



[issue16934] qsort doesn't work for double arrays

2013-01-11 Thread Mark Dickinson

Mark Dickinson added the comment:

Closing as invalid:  the issue is not in Python but with the CMPFUNC line.  
Your py_cmp_func should return an integer rather than a float to be compatible 
with libc.qsort.

--
resolution:  - invalid
status: open - closed

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