Skip to content

Conversation

kamilturek
Copy link
Contributor

@kamilturek kamilturek commented Nov 8, 2022

This PR fixes the exception message in ctypes docs.

Closes #99266.

>>> strchr = libc.strchr
>>> strchr.restype = c_char_p
>>> strchr.argtypes = [c_char_p, c_char]
>>> 
>>> strchr(b"abcdef", b"def")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ctypes.ArgumentError: argument 2: TypeError: wrong type

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ArgumentError: argument 2: TypeError: one character string expected
ArgumentError: argument 2: TypeError: wrong type
Copy link
Contributor Author

@kamilturek kamilturek Nov 8, 2022

Choose a reason for hiding this comment

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

Also, it should be ctypes.ArgumentError instead of ArgumentError here and in a few other places. I can take care of it in a separate PR.

@kamilturek kamilturek marked this pull request as ready for review November 8, 2022 23:33
@kamilturek kamilturek closed this Nov 9, 2022
@kamilturek kamilturek deleted the gh-99266 branch November 9, 2022 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ctypes: wrong exception message in docs
2 participants