-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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 <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
…) (GH-129961) gh-46236: Document `PyUnicode_DecodeCodePageStateful` (GH-127934) (cherry picked from commit 8d9d3e4) Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
…) (GH-129962) gh-46236: Document `PyUnicode_DecodeCodePageStateful` (GH-127934) (cherry picked from commit 8d9d3e4) Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Move deprecated PyUnicode API docs to new section Move Py_UNICODE to a new "Deprecated API" section. Formally soft-deprecate PyUnicode_READY, and move it Document and soft-deprecate PyUnicode_IS_READY, and move it Document PyUnicode_IS_ASCII, PyUnicode_CHECK_INTERNED PyUnicode_New docs: Clarify requirements for "fresh" strings PyUnicodeWriter_DecodeUTF8Stateful: Link "error-handlers" Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* 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 <encukou@gmail.com> * Change doc --------- Co-authored-by: Petr Viktorin <encukou@gmail.com>
@encukou Let's remove the
|
I checked the checkbox :-) |
(cherry picked from commit 8768df2)
…onGH-130335) * Clarify sys.getdefaultencoding() documentation * Add missing documentation for PyUnicode_GetDefaultEncoding, the C equivalent of sys.getdefaultencoding
Move deprecated PyUnicode API docs to new section Move Py_UNICODE to a new "Deprecated API" section. Formally soft-deprecate PyUnicode_READY, and move it Document and soft-deprecate PyUnicode_IS_READY, and move it Document PyUnicode_IS_ASCII, PyUnicode_CHECK_INTERNED PyUnicode_New docs: Clarify requirements for "fresh" strings PyUnicodeWriter_DecodeUTF8Stateful: Link "error-handlers" Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* 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 <encukou@gmail.com> * Change doc --------- Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
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 <vstinner@python.org>
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. |
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
#132925The text was updated successfully, but these errors were encountered: