GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix `PyUnicode` functions for Python 3.13 by cdce8p · Pull Request #17504 · python/mypy

Conversation

@cdce8p

@cdce8p cdce8p commented Jul 7, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Replace _PyUnicode_EqualToASCIIString with PyUnicode_EqualToUTF8.

https://docs.python.org/dev/c-api/unicode.html#c.PyUnicode_EqualToUTF8
python/cpython#110289

Fixes

  /home/runner/work/mypy/mypy/mypyc/lib-rt/getargs.c: In function ‘vgetargskeywords’: (diff)
  /home/runner/work/mypy/mypy/mypyc/lib-rt/pythonsupport.h:310:45: error: implicit declaration of function ‘_PyUnicode_EqualToASCIIString’; did you mean ‘CPyUnicode_EqualToASCIIString’? [-Werror=implicit-function-declaration] (diff)
    310 | #define CPyUnicode_EqualToASCIIString(x, y) _PyUnicode_EqualToASCIIString(x, y) (diff)
        |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (diff)
  /home/runner/work/mypy/mypy/mypyc/lib-rt/getargs.c:398:21: note: in expansion of macro ‘CPyUnicode_EqualToASCIIString’ (diff)
    398 |                 if (CPyUnicode_EqualToASCIIString(key, kwlist[i])) { (diff)
        |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (diff)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cdce8p
Fix PyUnicode functions for Python 3.13
2add82f
@cdce8p cdce8p added the topic-mypyc mypyc bugs label Jul 7, 2024
hauntsaninja
hauntsaninja approved these changes Jul 7, 2024
View reviewed changes

@hauntsaninja hauntsaninja left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nit: want to change the comment on L83 of str_ops.c?

I guess we could still use _PyUnicode_FastCopyCharacters, but is maybe not the biggest deal

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cdce8p
Update comment
61db261
@cdce8p

cdce8p commented Jul 7, 2024

Copy link
Copy Markdown
Collaborator Author

nit: want to change the comment on L83 of str_ops.c?

Done!

I guess we could still use _PyUnicode_FastCopyCharacters, but is maybe not the biggest deal

Yeah, technically _PyUnicode_FastCopyCharacters was only moved to internal/pycore_unicodeobject.h which we still include for _PyUnicode_EQ (see #17506). However, moving to the public PyUnicode_CopyCharacters might be the better call here (even if slightly slower if at all).
https://github.com/python/cpython/blob/v3.13.0b3/Include/internal/pycore_unicodeobject.h#L56

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cdce8p
Revert _PyUnicode_FastCopyCharacters changes
a6fb7b4
@cdce8p

cdce8p commented Jul 7, 2024

Copy link
Copy Markdown
Collaborator Author

I guess we could still use _PyUnicode_FastCopyCharacters, but is maybe not the biggest deal

Yeah, technically _PyUnicode_FastCopyCharacters was only moved to internal/pycore_unicodeobject.h which we still include for _PyUnicode_EQ (see #17506). However, moving to the public PyUnicode_CopyCharacters might be the better call here (even if slightly slower if at all). https://github.com/python/cpython/blob/v3.13.0b3/Include/internal/pycore_unicodeobject.h#L56

Scratch that. Let's just continue using _PyUnicode_FastCopyCharacters here. It's also used in _PyUnicode_JoinArray which this functions is adapted from.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hauntsaninja
hauntsaninja merged commit 966d6d3 into python:master Jul 7, 2024
@cdce8p
cdce8p deleted the fix-3.13-unicode branch July 7, 2024 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hauntsaninja hauntsaninja hauntsaninja approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic-mypyc mypyc bugs

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@cdce8p @hauntsaninja
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.