Old numeric, `sys.maxint`, `*.__nonzero` #3038

Closed
charris opened this Issue Feb 28, 2013 · 4 comments

Comments

Projects
None yet
2 participants
Owner

charris commented Feb 28, 2013

These only show up in oldnumeric when 2to3 with the 2to3 renames and nonzero fixers. The replacement for sys.maxint in python3 is sys.maxsize, but the two aren't the same, the latter the size of Py_ssize_t. Likewise the the replacement for __nonzero is __bool__, but anyone using old numeric is likely to have made the change.

Because oldnumeric will go away, I suggest we leave those attributes unchanged and advertize that oldnumeric isn't supported in python 3.

Owner

njsmith commented Feb 28, 2013

We might even just want to put a guard at the top of oldnumeric.init
saying

if sys.version[0] >= 3:
raise NotSupportedError(...)
On 28 Feb 2013 07:17, "Charles Harris" notifications@github.com wrote:

These only show up in oldnumeric when 2to3 with the 2to3 renames and
nonzero fixers. The replacement for sys.maxint in python3 is sys.maxsize,
but the two aren't the same, the latter the size of Py_ssize_t. Likewise
the the replacement for nonzero is __bool, but anyone using old
numeric is likely to have made the change.

Because oldnumeric will go away, I suggest we leave those attributes
unchanged and advertize that oldnumeric isn't supported in python 3.


Reply to this email directly or view it on GitHubhttps://github.com/numpy/numpy/issues/3038
.

Owner

charris commented Feb 28, 2013

That sounds like a good idea to me.

Owner

charris commented Apr 13, 2013

Messes up the tests, though. The import fails for python3 and the tests end. Might be able to slip a warning through. I tried this a while ago, so I'm a bit hazy on the details of the result.

Owner

charris commented Apr 14, 2013

Given that no issues have been raised since Python 3 compatible Numpy 1.5, and that the oldnumeric package is reaching end of life, I made the sys.maxsize substitution for Python >= 3 and added a __bool__ method that duplicates the current __nonzero__ method. So closing this.

@charris charris closed this Apr 14, 2013

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