Skip to content

cffi: FFI.string invalid signature #9735

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

Closed
senyai opened this issue Feb 14, 2023 · 2 comments · Fixed by #10012
Closed

cffi: FFI.string invalid signature #9735

senyai opened this issue Feb 14, 2023 · 2 comments · Fixed by #10012
Labels
stubs: false positive Type checkers report false errors

Comments

@senyai
Copy link

senyai commented Feb 14, 2023

def string(self, cdata: CData, maxlen: int = ...) -> bytes | str: ...

I know that maxlen agument is optional.

@senyai
Copy link
Author

senyai commented Feb 14, 2023

After installing python -m pip install types-cffi --user (1.15.1.15) I got this file structure in site-packages:

types_cffi-1.15.1.5.dist-info/INSTALLER
types_cffi-1.15.1.5.dist-info/WHEEL
types_cffi-1.15.1.5.dist-info/METADATA
types_cffi-1.15.1.5.dist-info/top_level.txt
types_cffi-1.15.1.5.dist-info/REQUESTED
_cffi_backend-stubs/__init__.pyi
_cffi_backend-stubs/METADATA.toml
cffi-stubs/recompiler.pyi
cffi-stubs/error.pyi
cffi-stubs/__init__.pyi
cffi-stubs/lock.pyi
cffi-stubs/ffiplatform.pyi
cffi-stubs/vengine_gen.pyi
cffi-stubs/model.pyi
cffi-stubs/cparser.pyi
cffi-stubs/api.pyi
cffi-stubs/commontypes.pyi
cffi-stubs/cffi_opcode.pyi
cffi-stubs/backend_ctypes.pyi
cffi-stubs/setuptools_ext.pyi
cffi-stubs/vengine_cpy.pyi
cffi-stubs/verifier.pyi
cffi-stubs/pkgconfig.pyi
cffi-stubs/METADATA.toml

where cffi-stubs/api.pyi has the right signature and _cffi_backend-stubs/__init__.pyi has the wrong one: def string(self, cdata: CData, maxlen: int) -> bytes | str: ... What is going on?

@srittau
Copy link
Collaborator

srittau commented Feb 15, 2023

This looks to be a bug in stubs/cffi/_cffi_backend.pyi. PR welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: false positive Type checkers report false errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants