-
-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Argument Clinic: broken support for 'O!' #64340
Comments
First, the documentation says that syntax for 'O!' conversion is Second, from this declaration /*[clinic]
[clinic]*/ Argument Clinic generates following parsing code: if (!PyArg_ParseTuple(args,
"O!:ham",
PyList_Type, &items))
goto exit; It is wrong, should be &PyList_Type. |
So a documentation error and having to manually specify "&" at the front of your string means it's "broken"? Nevertheless, I'll take a look at it. |
You can't manually specify "&" at the front of the name. |
Actually, the documentation (the "howto") states: Note that object() must explicitly support each Python type you specify for the type argument. Currently it only supports str. It should be easy to add more, just edit Tools/clinic/clinic.py, search for O! in the text, and add more entries to the dict mapping types to strings just above it. Maybe this is a bad API. But it's not broken. |
Attached is a new, simpler approach for supporting O!. The object() converter now takes two arguments:
I'll write some documentation for it now, but I wanted to post the code so I could get a review. p.s. Why was is marked "crash" and "release blocker"? That's very inaccurate. And assigned to docs? WTH? |
It is marked "crash" because Argument Clinic generates code which crashes. It is assigned to docs because this feature documentation is misleading. |
There are lots of ways you can crash Python by giving erroneous input to Argument Clinic. Clinic has no visibility into the C type system, so it has no way of verifying whether or not the type objects you pass in are correct. That's unfixable and not really interesting. |
New changeset ddb5cd3e0860 by Larry Hastings in branch 'default': |
Argument Clinic's support for "O!" is now simpler and more flexible. It's not as convenient as the previous API, but that API wasn't really sustainable. I'm assuming this fixes your problem; if not please open a new issue. |
…"O!" format unit. GitHub-Issue-Link: python/cpython#64340
…"O!" format unit. GitHub-Issue-Link: python/cpython#64340
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: