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 the preferred naming convention for new API #1126

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

Document the preferred naming convention for new API #1126

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

Comments

@erlend-aasland
Copy link
Contributor

We need a naming convention for new versions of an existing API. Illustrated by an example:

PyFoo_Bar() is a problematic API; it returns a borrowed reference, suppresses arbitrary exceptions, and requires callers to check PyErr_Occurred() to find out if an exception was raised. A PR now exists to replace PyFoo_Bar() with a new and non-problematic API, but unfortunately that PR cannot be merged, because unlike the implementation of the new API, there is no consensus on the naming of the new API; after all, PyFoo_Bar() is the perfect name. How to proceed?

@vstinner has suggested to add a Ref suffix when fixing APIs that return borrowed references1.

I propose to follow the SQLite practise of adding a version specifier2 if an API is replaced.

Footnotes

  1. PyFoo_Bar would become PyFoo_BarRef, since it now returns a strong reference.

  2. PyFoo_Bar would become PyFoo_Bar_v2.

@erlend-aasland
Copy link
Contributor Author

In capi-workgroup/problems#52 (comment), @vstinner points out that there is already precedent for using the number suffix in the Python C API.

@erlend-aasland
Copy link
Contributor Author

Closing as not planned. See also capi-workgroup/problems#52 (comment).

@erlend-aasland erlend-aasland closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant