Skip to content

Loading…

Typestring "h2" works in 1.6, fails in master #294

Closed
njsmith opened this Issue · 9 comments

5 participants

@njsmith
NumPy member

Problem (which breaks scipy):
http://mail.scipy.org/pipermail/numpy-discussion/2012-June/062605.html

Analysis:
http://mail.scipy.org/pipermail/numpy-discussion/2012-June/062606.html

Todo:

  • Re-enable parsing of type-strings like "h2" before the 1.7 release [DONE]
  • Give a deprecation warning for type-strings like "h100". Possibly also for type-strings like "h2" -- this isn't obvious. [DONE]
  • Disable at least "h100"- style type-strings for 1.9, or whenever we decide to finalize the deprecations that started in 1.7.
@certik

@njsmith, is this issue fixed now?

@njsmith
NumPy member

The 1.7 part of it is; I moved the milestone to 1.8.

@romanstingler

blackout@debian:~$ python3
Python 3.2.3 (default, Feb 20 2013, 14:44:27)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import numpy as np
np.empty((1,), dtype='>h1000000')
array([-22330], dtype=int16)
np.version
'1.9.0.dev-48981a6'
np.empty((1,), dtype='h100')
array([-14680], dtype=int16)

gives me negative numbers

@charris
NumPy member

Working now. Types like h100 also pass as the number is simply ignored. It might be better at some point to raise an error for those.

@charris charris closed this
@seberg
NumPy member

We do, there is a deprecation warning in place.

@charris
NumPy member

It isn't enabled, at least I don't see it.

@seberg
NumPy member

Just added it to the 1.7 deprecation follow up ticket. It is there (and I think was new in 1.7):

In [1]: import warnings; warnings.filterwarnings('always')

In [2]: np.dtype('h100')
/usr/bin/ipython:1: DeprecationWarning: Specified size is invalid for this data type.
Size will be ignored in NumPy 1.7 but may throw an exception in future versions.
  #! /usr/bin/python
Out[2]: dtype('int16')
@seberg
NumPy member

wow, there is an explicit 1.7 there sneeking in, not quite right of course... Maybe we can even turn it into an error in 1.9...

@charris
NumPy member

Ah, gotcha. Yes, making wrong sizes an error in 1.9 seems reasonable, should be mentioned in the release notes if we do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.