-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Document PyUnicode_* API #46236
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
Comments
I was wandering whether the pointer returned by PyUnicode_AsString needs I notice that the documentation for several other unicode functions is PyUnicode_Resize It would probably be a good idea to polish up the documentation for |
In addition to the above mentioned functions I found these to be PyUnicode_DecodeUTF7 From the original list the following functions seem to have been removed: PyUnicode_InternImmortal I try to put together a patch for some of these during the weekend. |
Ok, here is my shot at a patch for at least some of the undocumented PyUnicode_FromFormat Please thoroughly review this patch since I didn't really digg into the |
The patch looks alright. I don't like the documentation for .. cfunction:: PyObject* PyUnicode_FromFormatV(const char *format, Equivalent to the function :cfunc:`PyUnicode_FromFormat`, except that |
Is it worth applying the patch given the complete rewrite of unicode for 3.3 via PEP-393? |
On 30.03.2013 13:09, Mark Lawrence wrote:
PEP-393 only changed the way Unicode is internally stored. |
Remaining undocumented functions: From this issue: PyUnicode_RSplit From bpo-10435: PyUnicode_IsIdentifier From bpo-18688: Py_UNICODE_REPLACEMENT_CHARACTER |
PyUnicode_DecodeCodePageStateful Following functions likely should be wrapped with "#ifndef Py_LIMITED_API": _PyUnicode_ClearStaticStrings |
""" _PyUnicode_ClearStaticStrings It's already the case since at least Python 3.7. Extract of Python 3.7 Include/unicodeobject.h: #ifndef Py_LIMITED_API
/* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/
PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);
/* Clear all static strings. */
PyAPI_FUNC(void) _PyUnicode_ClearStaticStrings(void);
/* Fast equality check when the inputs are known to be exact unicode types
and where the hash values are equal (i.e. a very probable match) */
PyAPI_FUNC(int) _PyUnicode_EQ(PyObject *, PyObject *);
#endif /* !Py_LIMITED_API */ |
…eful` `PyUnicode_DecodeCodePageStateful` is in the limited C-API, and the document does not exist.
Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
…-127934) (cherry picked from commit 8d9d3e4) Co-authored-by: Yuki Kobayashi <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
…-127934) (cherry picked from commit 8d9d3e4) Co-authored-by: Yuki Kobayashi <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
…) (GH-129961) gh-46236: Document `PyUnicode_DecodeCodePageStateful` (GH-127934) (cherry picked from commit 8d9d3e4) Co-authored-by: Yuki Kobayashi <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
…) (GH-129962) gh-46236: Document `PyUnicode_DecodeCodePageStateful` (GH-127934) (cherry picked from commit 8d9d3e4) Co-authored-by: Yuki Kobayashi <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
* Add missing PyUnicode_Append() doc * Change the copied content * Add '`` ``' * Change doc * Add PyUnicode_AppendAndDel function doc * Change doc * Add PyUnicode_AppendAndDel to refcounts * Change doc * Change doc Co-authored-by: Petr Viktorin <[email protected]> * Change doc --------- Co-authored-by: Petr Viktorin <[email protected]>
|
Co-authored-by: Stan Ulbrych <[email protected]>
cpython/Include/unicodeobject.h Line 351 in 05d0559
cpython/Include/unicodeobject.h Line 364 in 05d0559
cpython/Include/unicodeobject.h Line 400 in 05d0559
cpython/Include/unicodeobject.h Line 378 in 05d0559
|
No, I don't think that it's worth it to document them if they are going to be removed. |
Co-authored-by: Victor Stinner <[email protected]>
PyUnicode_FromFormatV is documented. |
I agree, though they have been deprecated for many years but there is no planned removal date that I can find. Should we just remove them now? |
IMO now it's too late for the 3.14 release cycle. It would be better to schedule such removal at the start of a new dev cycle, such as Python 3.15. Someone also has to check if these functions are used in the wild (ex: run a code search). |
cc @serhiy-storchaka who originally deprecated them in 0093907 A new issue is probably best for this, scheduling for 3.15 seems good for now. |
(cherry picked from commit bba14c3) # Conflicts: # Doc/c-api/unicode.rst
(cherry picked from commit bba14c3) # Conflicts: # Doc/c-api/unicode.rst
The list needs to be updated, just |
(cherry picked from commit f34ec09) Co-authored-by: Stan Ulbrych <[email protected]>
The list is complete. I close the issue. Thanks to everybody who was involved in this old issue (2008!). |
Uh oh!
There was an error while loading. Please reload this page.
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:
[edit @encukou]: Converting the lists below to checkboxes:
PyUnicode_InternImmortal(removed in 3.12)PyUnicode_SetDefaultEncoding(removed in 3.2)_PyUnicode_ClearStaticStrings(removed in 3.9)_PyUnicode_EQ(removed in 3.14)_PyUnicode_FromId(private)Linked PRs
PyUnicode_DecodeCodePageStateful
#127934PyUnicode_DecodeCodePageStateful
(GH-127934) #129961PyUnicode_DecodeCodePageStateful
(GH-127934) #129962PyUnicodeIter_Type
#132925PyUnicodeIter_Type
(GH-132925) #133149The text was updated successfully, but these errors were encountered: