Skip to content

MNT: migrate away from deprecated c-api #17680

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

Merged
merged 1 commit into from
Jun 20, 2020

Conversation

tacaswell
Copy link
Member

The new macros were added in py33 so all versions of Python we support
have them.

closes #17629

The new macros were added in py33 so all versions of Python we support
have them.

closes matplotlib#17629
@tacaswell tacaswell added this to the v3.3.0 milestone Jun 18, 2020
@@ -635,11 +635,10 @@ static PyObject *PyFT2Font_set_text(PyFT2Font *self, PyObject *args, PyObject *k
size_t size;

if (PyUnicode_Check(textobj)) {
size = PyUnicode_GET_SIZE(textobj);
size = PyUnicode_GET_LENGTH(textobj);
codepoints.resize(size);
Copy link
Contributor

@anntzer anntzer Jun 18, 2020

Choose a reason for hiding this comment

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

maybe simpler and more efficient to just use https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_AsUCS4 or https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_AsUCS4Copy instead of managing and additional temporay buffer ourselves?
Edit: Bah, it's too complicated given that we also support bytes input.

Copy link
Member Author

Choose a reason for hiding this comment

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

My goal here was the minimal fix to get us off to non-deprecated API. There is some discussion of removing the deprecated macros in 3.11 so I would rather get something in ASAP.

Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

This seems a reasonable minimal change for 3.3.

@WeatherGod WeatherGod merged commit 91229f1 into matplotlib:master Jun 20, 2020
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jun 20, 2020
QuLogic added a commit that referenced this pull request Jun 20, 2020
…680-on-v3.3.x

Backport PR #17680 on branch v3.3.x (MNT: migrate away from deprecated c-api)
@tacaswell tacaswell deleted the mnt_remove_deprecated_c branch June 22, 2020 17:28
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.

Use of Python deprecated APIs.
4 participants