Skip to content

lexsort segfault sorting strings (Trac #298) #896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
numpy-gitbot opened this issue Oct 19, 2012 · 2 comments
Closed

lexsort segfault sorting strings (Trac #298) #896

numpy-gitbot opened this issue Oct 19, 2012 · 2 comments

Comments

@numpy-gitbot
Copy link

Original ticket http://projects.scipy.org/numpy/ticket/298 on 2006-09-28 by trac user ericjones, assigned to unknown.

I've been using the new record arrays and lexsort from numpy quite a lot lately. Very cool stuff.

Using the nightly egg for numpy from here (I believe it is up to date...):

http://code.enthought.com/enstaller/eggs/numpy-nightly-py2.4-win32.egg

I get segfaults when using lexsort on character arrays. A lot of my columns in record arrays are string based, so sorting the arrays based on these columns would be really handy.

Here is an example that crashes for me.

C:\wrk\mt\trunk\src\lib\mt\statement\tests>python
Python 2.4.3 - Enthought Edition 1.0.0 (#553, Aug 2 2006, 12:09:59) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from numpy import lexsort
lst = [1,2,3]
lexsort((lst,))
array([0, 1, 2])
lst = ['abc','cde','fgh']
lexsort((lst,))

thanks,
eric

@numpy-gitbot
Copy link
Author

@teoliphant wrote on 2006-09-28

Thanks for the test. The argsort for strings and unicode using the merge sort was cut-and-pasted from the code for fixed-size data-types. The length of the string wasn't being used at all correctly for indexing into the array.

This has been fixed in SVN r3229.

@numpy-gitbot
Copy link
Author

trac user ericjones wrote on 2006-09-28

Cool. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant