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

Document guidelines for when to use dynamically typed APIs #1127

Closed
erlend-aasland opened this issue Jun 26, 2023 · 2 comments
Closed

Document guidelines for when to use dynamically typed APIs #1127

erlend-aasland opened this issue Jun 26, 2023 · 2 comments
Labels
enhancement guide-new content Additions; New content or section needed needs: decision Needs consensus decision from core devs topic-c api

Comments

@erlend-aasland
Copy link
Contributor

erlend-aasland commented Jun 26, 2023

We need to agree on guidelines for when to use and when to not use dynamically typed APIs.

See capi-workgroup/problems#31 (The C API is weakly typed)

In capi-workgroup/problems#31 (comment), @markshannon suggests:

PyObject *obj, PyDictObject *dict;
PyObject_GetItem(obj);   // 👍 
PyDict_GetItem(dict);   // 👍 
PyObject_GetItem((PyObject *)dict); // Pointlessly inefficient
PyDict_GetItem((PyDictObject *)obj); // Unsafe
@erlend-aasland erlend-aasland changed the title Document guidelines for strongly and weakly typed APIs Document guidelines for when to use dynamically typed APIs Jun 26, 2023
@vstinner
Copy link
Member

I suppose that a guideline should be decided in capi-workgroup/problems#31 first.

@erlend-aasland
Copy link
Contributor Author

I suppose that a guideline should be decided in capi-workgroup/problems#31 first.

Definitely!

@willingc willingc added topic-c api guide-new content Additions; New content or section needed needs: decision Needs consensus decision from core devs enhancement and removed enhancement labels Oct 11, 2023
@erlend-aasland erlend-aasland closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement guide-new content Additions; New content or section needed needs: decision Needs consensus decision from core devs topic-c api
Projects
None yet
Development

No branches or pull requests

3 participants