cpython/Doc/c-api
Stan Ulbrych 320316ef7e
[3.13] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130127)
We had the definition of what makes a character "printable" documented in three places, giving two different definitions.
The definition in the comment on `_PyUnicode_IsPrintable` was inverted; correct that.

With that correction, the two definitions turn out to be equivalent -- but to confirm that, you have to go look up, or happen to know, that those are the only five "Other" categories and only three "Separator" categories in the Unicode character database.  That makes it hard for the reader to tell whether they really are the same, or if there's some subtle difference in the intended semantics.

Fix that by cutting the C API docs' and the C comment's copies of the subtle details, in favor of referring to the Python-level docs. That ensures it's explicit that these are all meant to agree, and also lets us concentrate improvements to the wording in one place.

Speaking of which, borrow some ideas from the C comment, along with other tweaks, to hopefully add a bit more clarity to that one newly-centralized copy in the docs.

Also add a thorough test that the implementation agrees with this definition.

Author:    Greg Price <gnprice@gmail.com>

Co-authored-by: Greg Price <gnprice@gmail.com>
(cherry picked from commit 3402e133ef)
2025-02-17 15:02:39 +01:00
..
abstract.rst gh-85275: Remove old buffer APIs (#105137) 2023-06-02 01:12:40 +00:00
allocation.rst [3.13] Doc: C API: Delete claim that PyObject_Init is GC-aware (GH-126418) (#126431) 2024-11-05 15:31:16 +05:30
apiabiversion.rst gh-107298: Fix Sphinx warnings in the C API doc (#107302) 2023-07-27 01:41:15 +02:00
arg.rst [3.13] gh-90241: Clarify documentation for PyUnicode_FSConverter and PyUnicode_FSDecoder (GH-128451) (GH-128542) 2025-01-06 23:20:26 +02:00
bool.rst gh-110481, doc: Add "immortal" term to the glossary (#112180) 2023-11-17 15:09:19 +01:00
buffer.rst [3.13] gh-123609: Clarify usage of standalone PyBUF_FORMAT (GH-123778) (#123903) 2024-09-24 11:16:12 -07:00
bytearray.rst [3.13] gh-122623: Improve c-api/bytearray.rst with error handling info (GH-122624) (#122658) 2024-08-04 15:09:22 +03:00
bytes.rst gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() (GH-117160) 2024-03-25 16:32:11 +01:00
call.rst Add a version added note for PY_VECTORCALL_ARGUMENTS_OFFSET (#110963) 2023-10-23 19:00:52 +03:00
capsule.rst gh-107298: Fix yet more Sphinx warnings in the C API doc (GH-107345) 2023-07-27 18:44:32 +03:00
cell.rst [3.13] gh-121533: Improve PyCell_[Get,Set] docs: mention the exceptions (GH-121534) (#121539) 2024-07-09 16:06:46 +00:00
code.rst [3.13] gh-70870: Clarify dual usage of 'free variable' (GH-122545) (#125088) 2024-10-08 17:58:47 +10:00
codec.rst gh-107298: Fix doc references to undocumented modules (#107300) 2023-07-26 18:59:06 +02:00
complex.rst [3.13] gh-121834: Improve complex C-API docs (GH-121835) (#121895) 2024-07-17 07:25:07 +00:00
concrete.rst GH-97950: Use new-style index directive ('object') (#104158) 2023-05-04 13:04:41 +03:00
contextvars.rst gh-115664: Fix ordering of more versionadded and versionchanged directives (GH-116298) 2024-03-07 10:05:03 +02:00
conversion.rst Document PyOS_strtoul and PyOS_strtol (GH-114048) 2024-01-26 19:44:45 +02:00
coro.rst bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602) 2021-01-06 12:38:26 +01:00
datetime.rst [3.13] gh-123517: Remove unnecessary :meth: parentheses (gh-123518) (GH-123577) 2024-09-02 16:00:04 +02:00
descriptor.rst bpo-40170: Convert PyDescr_IsData() to static inline function (GH-24535) 2021-02-16 08:50:00 +01:00
dict.rst [3.13] gh-120858: PyDict_Next should not lock the dict (GH-120859) (#120964) 2024-06-24 18:41:19 +00:00
exceptions.rst [3.13] gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) (#124556) 2024-09-25 17:29:48 -07:00
file.rst gh-115172: Fix explicit index extries for the C API (GH-115173) 2024-02-11 12:23:30 +02:00
float.rst [3.13] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122012) 2024-07-19 09:13:08 +00:00
frame.rst [3.13] gh-118915: C API: Document frame locals proxies. (GH-127720) (#127831) 2024-12-11 16:34:35 +00:00
function.rst [3.13] gh-130169: Fix broken list markup in Doc/c-api/function.rst (GH-130174) (#130175) 2025-02-16 11:01:45 +00:00
gcsupport.rst gh-101100: Fix sphinx warnings in c-api/gcsupport.rst (#114786) 2024-02-10 15:59:23 -07:00
gen.rst bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602) 2021-01-06 12:38:26 +01:00
hash.rst [3.13] gh-111389: Add PyHASH_MULTIPLIER constant (GH-119214) (#119334) 2024-06-04 09:26:25 +02:00
import.rst [3.13] gh-101100: Consolidate documentation on ModuleType attributes (#124709) (#125208) 2024-10-09 20:03:30 +01:00
index.rst gh-111997: C-API for signalling monitoring events (#116413) 2024-05-04 08:23:50 +00:00
init.rst [3.13] gh-101100: Docs: Fix some typos in the document (GH-129988) (#129997) 2025-02-11 21:37:25 +00:00
init_config.rst [3.13] gh-126821: Add versionadded annotation to use_system_logger feature. (GH-127755) (#127806) 2024-12-10 21:38:12 +00:00
intro.rst gh-115172: Fix explicit index extries for the C API (GH-115173) 2024-02-11 12:23:30 +02:00
iter.rst More minor fixes to C API docs (GH-31525) 2022-04-02 12:31:05 -07:00
iterator.rst gh-107298: Fix Sphinx warnings in the C API doc (#107302) 2023-07-27 01:41:15 +02:00
list.rst [3.13] gh-121403: Add notes for PyList_GetXXX APIs about the need for init (gh-121626) (gh-121827) 2024-07-16 14:32:31 +00:00
long.rst [3.13] Doc: Fix typos (GH-125728) (#125773) 2024-10-21 08:49:31 +00:00
mapping.rst gh-108511: Add C API functions which do not silently ignore errors (GH-109025) 2023-09-17 14:23:31 +03:00
marshal.rst [3.13] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122012) 2024-07-19 09:13:08 +00:00
memory.rst [3.13] gh-119802: Update memory management docs for free-threaded build (gh-124006) (#124054) 2024-09-23 17:31:01 -07:00
memoryview.rst gh-101100: Fix sphinx warnings in Doc/c-api/memoryview.rst (GH-114669) 2024-01-29 11:56:11 +02:00
method.rst gh-107091: Fix the use of some C domain roles (#107092) 2023-07-23 12:27:05 +02:00
module.rst [3.13] gh-101944: Clarify PyModule_AddObjectRef() documentation (GH-129433) (#129612) 2025-02-03 12:02:00 +00:00
monitoring.rst [3.13] Doc: Fix typos (GH-125728) (#125773) 2024-10-21 08:49:31 +00:00
none.rst gh-110481, doc: Add "immortal" term to the glossary (#112180) 2023-11-17 15:09:19 +01:00
number.rst [3.13] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122012) 2024-07-19 09:13:08 +00:00
object.rst [3.13] gh-127954: Document PyObject_DelItemString (GH-127986) (#128496) 2025-01-04 20:53:30 +00:00
objimpl.rst Doc: Replace the deprecated highlightlang directive by highlight. (#13377) 2019-05-17 15:25:34 +05:30
perfmaps.rst gh-103295: expose API for writing perf map files (#103546) 2023-05-21 11:12:24 +01:00
refcounting.rst [3.13] Use pep role instead of url (GH-121611) (#124172) 2024-09-23 11:39:16 -07:00
reflection.rst [3.13] gh-118934: Fix PyEval_GetLocals docs (PEP 667) (GH-119934) 2024-06-02 05:57:17 +00:00
sequence.rst gh-101100: Fix some broken sphinx references (#107095) 2023-07-23 03:23:44 -06:00
set.rst gh-101100: Fix Sphinx reference warnings (GH-112416) 2023-11-25 15:40:19 -08:00
slice.rst [3.13] gh-121567: Improve slice C-API docs by mentioning exceptions (GH-121568) (#121578) 2024-07-10 11:13:40 +00:00
stable.rst [3.13] gh-127253: Note that Stable ABI is about ABI stability (GH-127254) (GH-127557) 2024-12-03 13:57:42 +01:00
structures.rst Fix the PyGetSetDef documentation (GH-116056) 2024-03-05 17:48:20 +02:00
sys.rst [3.13] gh-127791: Fix, document, and test PyUnstable_AtExit (GH-127793) (#127819) 2024-12-11 13:40:45 +00:00
time.rst [3.13] GH-109975: Copyedit 3.13 What's New: C API (GH-124313) (#124334) 2024-09-23 11:14:13 -07:00
tuple.rst [3.13] gh-124182: Explain naming rules for struct sequence types (GH-124335) (#125057) 2024-10-07 23:47:30 +02:00
type.rst [3.13] Docs: Fix incorrect indents in c-api/type.rst (GH-127449) (#127460) 2024-12-01 10:50:51 +02:00
typehints.rst gh-107298: Fix Sphinx warnings in the C API doc (#107302) 2023-07-27 01:41:15 +02:00
typeobj.rst [3.13] gh-129912: Fix references to Py_TPFLAGS_MANAGED_DICT (gh-130044) (gh-130059) 2025-02-12 22:56:02 +00:00
unicode.rst [3.13] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130127) 2025-02-17 15:02:39 +01:00
utilities.rst gh-110850: Add PyTime_t C API (GH-115215) 2024-02-12 18:13:10 +01:00
veryhigh.rst [3.13] gh-118915: C API: Document compiler flag macros (GH-129028) (GH-129086) 2025-01-21 11:47:55 +01:00
weakref.rst [3.13] gh-118789: Add PyUnstable_Object_ClearWeakRefsNoCallbacks (GH-118807) (#120695) 2024-06-18 14:54:51 +00:00