Skip to content

DEP: Warn about assigning 'data' attribute of ndarray - #7275

Merged
charris merged 1 commit into
numpy:masterfrom
gfyoung:dep_array_data_set
Feb 29, 2016
Merged

charris merged 1 commit into
numpy:masterfrom
gfyoung:dep_array_data_set

Conversation

@gfyoung

@gfyoung gfyoung commented Feb 18, 2016

Copy link
Copy Markdown
Contributor

I don't like unsafe operations either. Closes #7093.

@njsmith

@charris

charris commented Feb 19, 2016

Copy link
Copy Markdown
Member

Do we want this to be a visible deprecation?

@gfyoung

gfyoung commented Feb 19, 2016

Copy link
Copy Markdown
Contributor Author

I get uneasy when there are memory issues of this kind involved, which is why I made the deprecation so visible. However, that is just my opinion.

Comment thread numpy/core/src/multiarray/getset.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment with date and numpy version? Grep for examples.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is better done in the standard way, grep for examples.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. I think my very first PR to numpy might have that! Let me double check.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard form is something like

        if (DEPRECATE("Calling partition with a non integer index"
                      " will result in an error in the future") < 0) {
            return NULL;
        }

@gfyoung

gfyoung commented Feb 19, 2016

Copy link
Copy Markdown
Contributor Author

@charris : Removed the mentioning of C code deprecations. Should be good to merge if there is nothing else.

@charris

charris commented Feb 29, 2016

Copy link
Copy Markdown
Member

What I meant by "visible" is VisibleDeprecationWarning which is not hidden by default.

@gfyoung

gfyoung commented Feb 29, 2016

Copy link
Copy Markdown
Contributor Author

Oh, I see. I think I misunderstood you the first time around. Is there a way to get a VisibleDeprecationWarning in the C code?

@charris

charris commented Feb 29, 2016

Copy link
Copy Markdown
Member

Could be improved a bit, but since deprecation is temporary, good enough. Thanks Greg.

charris added a commit that referenced this pull request Feb 29, 2016
DEP: Warn about assigning 'data' attribute of ndarray
@charris
charris merged commit 1bd18cd into numpy:master Feb 29, 2016
@gfyoung

gfyoung commented Feb 29, 2016

Copy link
Copy Markdown
Contributor Author

Oh, alright. No problem then!

@gfyoung
gfyoung deleted the dep_array_data_set branch February 29, 2016 01:38
@charris

charris commented Feb 29, 2016

Copy link
Copy Markdown
Member

You can grep for examples. It needs to be imported from the numpy package, which is OK since the import doesn't get run until the function is called and that is after numpy has been imported.

@gfyoung

gfyoung commented Feb 29, 2016

Copy link
Copy Markdown
Contributor Author

Hmmm...I guess I was trying to see how to invoke it at the C level since that's where I had the deprecation initially, but I suppose we could intercepted it at the Python level as well so that we could use VisibleDeprecationWarning IINM.

@charris

charris commented Feb 29, 2016

Copy link
Copy Markdown
Member

No, you can import it at the C level, grep for VisibleDeprecationWarning in multiarray.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants