Skip to content
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

Fix animation errors #2898

Merged
merged 2 commits into from May 13, 2014
Merged

Fix animation errors #2898

merged 2 commits into from May 13, 2014

Conversation

bytbox
Copy link
Contributor

@bytbox bytbox commented Mar 14, 2014

Three changes: use 'y#' in python 3, ignore errors from AsFileDescriptor (to allow use of BytesIO and similarly brain-dead objects as the target), and don't require setting of the position of the file handle to succeed (so that we can use streams).

Fixes #1891

PyObject_CallFunction(write_method, (char *)"s#", pixBuffer, NUMBYTES);
#endif
Copy link
Member

Choose a reason for hiding this comment

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

Good catch.

@tacaswell
Copy link
Member

Before this gets merged some of the changes in #2838 should be reverted so that the smoke tests run again.

@@ -70,6 +70,7 @@
Py_DECREF(ret);
fd = PyObject_AsFileDescriptor(file);
if (fd == -1) {
PyErr_Clear();
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this is the right solution. I think there are cases where you might want to return this error to the Python side. In cases where one doesn't, we are already calling PyErr_Clear in _png.cpp after calling mpl_PyFile_Dup. I think _backend_agg.cpp should also do that -- but I don't think it makes sense to do that here. The idea of this function is that a Python error should always be set when in returns NULL (like most Python/C API functions).

@mdboom
Copy link
Member

mdboom commented Mar 14, 2014

Thank for this!

@bytbox
Copy link
Contributor Author

bytbox commented Mar 14, 2014

Fixes made. #2838 is not in v1.3.x, so I'm not reverting those changes here. Should I do a separate PR on master for that?

@tacaswell
Copy link
Member

Sorry, didn't notice where this was going. On 1.3.x the smoke tests are never run so it's not a 'problem'.

1.3.x will get merged into master so defiantly don't repeat the full PR. If you want to do a PR for reverting the KnownFail changes please do, if not leaving a note for who ever merges this to clean it up should be enough.

@bytbox
Copy link
Contributor Author

bytbox commented Mar 14, 2014

Ok, #2900 takes care of the KnownFail.

@tacaswell tacaswell modified the milestones: v1.4.0, v1.3.x Mar 18, 2014
@tacaswell
Copy link
Member

@mdboom This outside of my comfort zone to approve, if you are happy can you merge this?

@tacaswell
Copy link
Member

on further digging it looks like there are really two animation bugs with, the smoketest failures are related to #2568, not #1891 .

@bytbox
Copy link
Contributor Author

bytbox commented Apr 15, 2014

Ping? (Don't want to break with etiquette too badly, but I'd like to see this merged in :)

@tacaswell
Copy link
Member

@bytbox Don't worry about pestering. This is marked to be dealt with before 1.4 is cut.

@mdboom Can you take another look at this?

@efiring
Copy link
Member

efiring commented May 11, 2014

My impression is that this PR has been vetted by @mdboom, and solves a problem up through Python 3.3, so maybe it is worth merging it now, into 1.3.x and from there into 1.4.x. If it is confirmed that there is a problem with 3.4, that can be treated separately.

@efiring
Copy link
Member

efiring commented May 11, 2014

As noted in my comment on #1891, this PR needs one more change: move the Py_DECREF(ret) on line 160 of file_compat.h up one level, so we have

        /* Seek Python-side handle to the FILE* handle position */
        ret = PyObject_CallMethod(file, "seek", MPL_OFF_T_PYFMT "i", position, 0);
        if (ret == NULL) {
            return -1;
        }
        Py_DECREF(ret);
    }
    return 0;

That will ensure Py_DECREF is called if and only if ret is not NULL.

@bytbox
Copy link
Contributor Author

bytbox commented May 13, 2014

Fixed.

@efiring
Copy link
Member

efiring commented May 13, 2014

@bytbox I don't know why Travis failed on Python 2, but it seems unrelated. (It looks familiar, and I think an explanation has been given, but I don't remember what it is.)

Would you fix the indentation of the Py_DECREF line, please? It should be 8 spaces (no tabs) so that it lines up with the } above.
Thank you.

@bytbox
Copy link
Contributor Author

bytbox commented May 13, 2014

Oops - fixed the indentation.

On Mon, 12 May 2014, Eric Firing wrote:

@bytbox I don't know why Travis failed on Python 2, but it seems unrelated. (It looks familiar, and I think an explanation has been given, but I don't remember what it is.)

Would you fix the indentation of the Py_DECREF line, please? It should be 8 spaces (no tabs) so that it lines up with the } above.
Thank you.


Reply to this email directly or view it on GitHub:
#2898 (comment)

Scott Lawrence

efiring added a commit that referenced this pull request May 13, 2014
@efiring efiring merged commit 2b74cb5 into matplotlib:v1.3.x May 13, 2014
@efiring
Copy link
Member

efiring commented May 13, 2014

@tacaswell, will you take care of merging this into 1.4.x? And, if we are not going to release another 1.3.x, let's stop merging anything into it.

@tacaswell
Copy link
Member

I think we have one or two other PRs that are against 1.3.x, it is probably not worth rebasing them.

I will merge this in tonight.

@tacaswell
Copy link
Member

I merged 1.3.x today so this should be taken care of.

@mangecoeur
Copy link

Just run into this bug - is this in 1.3 series or not in the end, seems the issue has not been closed...

@tacaswell
Copy link
Member

@mangecoeur Can you check using current master or the 1.4.0rc1 code? The fix for this was done after 1.3.1 was cut.

@mangecoeur
Copy link

@tacaswell can't change versions right now for various reasons, but I'm on 1.3.1 so that explains it... will wait for 1.4 release...

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

Successfully merging this pull request may close these issues.

None yet

6 participants