Skip to content

gh-99266: fix wrong exception message in ctypes docs #99267

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
wants to merge 1 commit into from

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

@@ -487,7 +487,7 @@ single character Python bytes object into a C char::
>>> strchr(b"abcdef", b"def")
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