gh-141004: Document PyUnicode_IS_COMPACT and PyUnicode_IS_COMPACT_ASCII macros#143494
gh-141004: Document PyUnicode_IS_COMPACT and PyUnicode_IS_COMPACT_ASCII macros#143494encukou merged 10 commits intopython:mainfrom
Conversation
Doc/c-api/unicode.rst
Outdated
|
|
||
| .. c:macro:: PyUnicode_IS_COMPACT(o) | ||
|
|
||
| Return true if the Unicode object *o* is a compact string. |
There was a problem hiding this comment.
Could you provide a small definition of what a "compact" string is? Same goes for IS_COMPACT_ASCII below.
There was a problem hiding this comment.
Sure, coming right up.
There was a problem hiding this comment.
I'd rather say they use the PyCompactUnicodeObject struct (and PyASCIIObject for COMPACT_ASCII). The docs for the structs discourage using them directly, which is a good thing. I don't think we should provide any details on the storage layouts.
Ideally, document these together with the struct.
There was a problem hiding this comment.
Could you also move the docs to the structs they refer to?
There was a problem hiding this comment.
Could you also move the docs to the structs they refer to?
I've moved them, please verify if its satisfactory placement. it groups the "Type" and "How to check for that Type" logic imo.
|
(FWIW, I want to deprecate these, but they have a use case that'll need a PEP with better API: https://discuss.python.org/t/82543.) [edit: link fixed) |
|
Could you also remove these from |
|
I'll update the wording. And yes, I'll remove them from ignored_c_api.txt to ensure they are properly checked going forward. |
| @@ -89,5 +89,4 @@ PyUnstable_EXECUTABLE_KIND_SKIP | |||
| # cpython/pylifecycle.h | |||
| Py_FrozenMain | |||
| # cpython/unicodeobject.h | |||
There was a problem hiding this comment.
Please remove this comment as well.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
Test failure unrelated to my docs change - multiprocessing timeout issue. |
|
|
Wait I'm sorry, do we go with the incoming change or the current change here? |
|
We needed to merge the two. I fixed it for you. |
|
@ZeroIntensity Yeah my bad, i was a little confused there. Thanks for the help Edit: I also think we need to remove some more lines from the ignore_c_api.txt as it claims some things to be documented but still existing in the file. |
|
@ZeroIntensity Could you update me on this PR? |
|
It's complaining that some C APIs are documented but also listed in |
…thon into doc-unicode-compact
|
@ZeroIntensity I think i fixed the test problem yeah |
|
Sorry, @Yashp002 and @encukou, I could not cleanly backport this to |
|
Sorry, @Yashp002 and @encukou, I could not cleanly backport this to |
…CT_ASCII macros (pythonGH-143494) (cherry picked from commit 42f7c2d)
|
GH-143785 is a backport of this pull request to the 3.14 branch. |
This PR documents
PyUnicode_IS_COMPACTandPyUnicode_IS_COMPACT_ASCII, which were identified as undocumented public macros in issue #141004.📚 Documentation preview 📚: https://cpython-previews--143494.org.readthedocs.build/