Skip to content

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 2, 2021

The PathGenerator constructor does not set a Python-level exception on
failure. Switch to use a PyArg_ParseTuple-style converter to get proper
error handling.

(Also, CALL_CPP already converts py::exception to Python-level
exceptions, so it doesn't need to be wrapped in a C++-level try...
catch.)

Closes https://gitter.im/matplotlib/matplotlib?at=60b71b8478e1d6477d7ad9a3
(well, the C error handling part at least).

PR Summary

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

The PathGenerator constructor does not set a Python-level exception on
failure.  Switch to use a PyArg_ParseTuple-style converter to get proper
error handling.

(Also, CALL_CPP already converts py::exception to Python-level
exceptions, so it doesn't need to be wrapped in a C++-level try...
catch.)
@tacaswell tacaswell added this to the v3.5.0 milestone Jun 2, 2021
@@ -333,12 +333,13 @@ PyRendererAgg_draw_path_collection(PyRendererAgg *self, PyObject *args, PyObject
PyObject *offset_position; // offset position is no longer used

if (!PyArg_ParseTuple(args,
"O&O&OO&O&O&O&O&O&O&O&OO:draw_path_collection",
"O&O&O&O&O&O&O&O&O&O&O&OO:draw_path_collection",
Copy link
Member

Choose a reason for hiding this comment

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

I don't know what these strings are. Was this just a typo before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this needs to be changed because I added &convert_pathgen. See https://docs.python.org/3/extending/extending.html#extracting-parameters-in-extension-functions

@QuLogic QuLogic merged commit a3fbf18 into matplotlib:master Jun 2, 2021
@anntzer anntzer deleted the pc branch June 2, 2021 22:06
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.

4 participants