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 _PyList_Extend for Python 3.13 #17503

Merged
merged 1 commit into from
Jul 7, 2024

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Jul 7, 2024

Replace _PyList_Extend with PyList_Extend from pythoncapi_compat.h.

python/cpython#111138
https://docs.python.org/dev/c-api/list.html#c.PyList_Extend

Fixes

  /home/runner/work/mypy/mypy/mypyc/lib-rt/list_ops.c: In function ‘CPyList_Extend’: (diff)
  /home/runner/work/mypy/mypy/mypyc/lib-rt/list_ops.c:259:12: error: implicit declaration of function ‘_PyList_Extend’; did you mean ‘CPyList_Extend’? [-Werror=implicit-function-declaration] (diff)
    259 |     return _PyList_Extend((PyListObject *)o1, o2); (diff)
        |            ^~~~~~~~~~~~~~ (diff)
        |            CPyList_Extend (diff)
  /home/runner/work/mypy/mypy/mypyc/lib-rt/list_ops.c:259:12: error: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Werror=int-conversion] (diff)
    259 |     return _PyList_Extend((PyListObject *)o1, o2); (diff)
        |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (diff)
  /home/runner/work/mypy/mypy/mypyc/lib-rt/dict_ops.c: In function ‘CPyDict_Keys’: (diff)
  /home/runner/work/mypy/mypy/mypyc/lib-rt/dict_ops.c:233:21: error: initialization of ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion] (diff)
    233 |     PyObject *res = _PyList_Extend((PyListObject *)list, view); (diff)
        |                     ^~~~~~~~~~~~~~ (diff)
  /home/runner/work/mypy/mypy/mypyc/lib-rt/dict_ops.c: In function ‘CPyDict_Values’: (diff)
  /home/runner/work/mypy/mypy/mypyc/lib-rt/dict_ops.c:253:21: error: initialization of ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion] (diff)
    253 |     PyObject *res = _PyList_Extend((PyListObject *)list, view); (diff)
        |                     ^~~~~~~~~~~~~~ (diff)
  /home/runner/work/mypy/mypy/mypyc/lib-rt/dict_ops.c: In function ‘CPyDict_Items’: (diff)
  /home/runner/work/mypy/mypy/mypyc/lib-rt/dict_ops.c:273:21: error: initialization of ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion] (diff)
    273 |     PyObject *res = _PyList_Extend((PyListObject *)list, view); (diff)
        |                     ^~~~~~~~~~~~~~ (diff)

@cdce8p cdce8p added the topic-mypyc mypyc bugs label Jul 7, 2024
@hauntsaninja hauntsaninja merged commit 9175ce5 into python:master Jul 7, 2024
14 checks passed
@cdce8p cdce8p deleted the fix-3.13-pylist-extend branch July 7, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-mypyc mypyc bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants