Skip to content

Issue #8650 fixed - #9602

Closed
malgamves wants to merge 2 commits into
matplotlib:masterfrom
malgamves:master
Closed

malgamves wants to merge 2 commits into
matplotlib:masterfrom
malgamves:master

Conversation

@malgamves

@malgamves malgamves commented Oct 28, 2017 •

Copy link
Copy Markdown

Fixed the system error mentioned in issue #8650

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Fixed the system error mentioned in issue #8650
Comment thread lib/matplotlib/backends/backend_agg.py Outdated
self._renderer.draw_path(gc, path, transform, rgbFace)
if rgbFace is not None:
rgbFace = tuple(rgbFace)
self._renderer.draw_path(gc, path, transform, rgbFace)

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.

You accidentally removed try

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Let me fix that, thanks!

Added the 'try:' i accidentally removed and fixed issue #8650
@tacaswell

Copy link
Copy Markdown
Member

The circle CI failures are because the commit this is based on is older than the fix for that ( #9325 ), those can be disregarded here (or @malgamves can you rebase on to current master?)

The failure on travis is due to some trailing whitespace. The automated style checkers are a bit annoying, but the do help keep the code-base consistent, which is important for big projects with lots of contributors.

It would be better if we had a test to exercise the original issue (to make sure this really fixes it!) but this code path is covered in the tests so I am 👍 to this going in with out an extra test.

Thanks for your work on this @malgamves !

@tacaswell tacaswell added this to the v2.2 milestone Oct 28, 2017
@Kojoley

Kojoley commented Oct 28, 2017

Copy link
Copy Markdown
Member

I do not think the fix is doing a right thing. In many places you can find rgbFace = mcolors.to_rgba(...) or accessing the parts of rgbFace like that

if rgbFace[3] == 0:

@malgamves

Copy link
Copy Markdown
Author

Yes, I can rebase on the current master. Lets see if that works.

@anntzer

anntzer commented Oct 29, 2017

Copy link
Copy Markdown
Contributor

I agree with @Kojoley that we should first figure out how a non-tuple made it to that point to start with (for example, it is relevant for mplcairo to know whether we can expect colorspecs to be normalized (hopefully yes) or not), and thus request a MWE from the OP of #8650.

@tacaswell

Copy link
Copy Markdown
Member

This is the last step before we drop down to the c++ layer, I suspect that not-tuple may be the correct type for the python side and tuple is the correct type for this call.

@anntzer

anntzer commented Oct 29, 2017 •

Copy link
Copy Markdown
Contributor

The culprit is

int convert_rgba(PyObject *rgbaobj, void *rgbap)

which uses PyArg_ParseTuple (which expects exactly a tuple).

Note that this is also used by draw_markers (https://github.com/matplotlib/matplotlib/blob/master/src/_backend_agg_wrapper.cpp#L254) so again we should either make sure to normalize the input early, or fix convert_rgba to accept any sequence.

(I tried to fix it quickly at the C-level but things are slightly messy because (of course...) 0-dim numpy arrays return true to PySequence_Check but trigger an error on PySequence_Size, bleh :/)

@jklymak

jklymak commented Sep 12, 2020

Copy link
Copy Markdown
Member

I'm going to close this - it fixes a poorly documented error, and no one else has complained. There also seems to be some petered-out concern w/ how this was implemented. Thanks @malgamves and sorry this didn't come to fruition.

@jklymak jklymak closed this Sep 12, 2020
@story645 story645 removed this from the future releases milestone Oct 6, 2022
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.

6 participants