cpython/Doc/c-api
Stan Ulbrych 8a598fb623
[3.12] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130125)
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.

Co-authored-by: Greg Price <gnprice@gmail.com>
(cherry picked from commit 3402e133ef)
2025-02-17 14:07:59 +01:00
..
abstract.rst bpo-41103: Resurrect the old buffer protocol. (GH-27437) 2021-07-29 12:46:47 +02:00
allocation.rst [3.12] Doc: C API: Delete claim that PyObject_Init is GC-aware (GH-126418) (#126432) 2024-11-05 15:31:37 +05:30
apiabiversion.rst [3.12] gh-107298: Fix Sphinx warnings in the C API doc (GH-107302) (GH-107375) 2023-07-28 06:40:16 +00:00
arg.rst [3.12] gh-90241: Clarify documentation for PyUnicode_FSConverter and PyUnicode_FSDecoder (GH-128451) (GH-128543) 2025-01-06 23:20:55 +02:00
bool.rst [3.12] gh-101100: Sphinx warnings: pick the low hanging fruits (GH-107386) (GH-107419) 2023-07-29 09:16:27 +03:00
buffer.rst [3.12] gh-123609: Clarify usage of standalone PyBUF_FORMAT (GH-123778) (GH-123904) 2024-11-01 12:38:23 -07:00
bytearray.rst [3.12] gh-122623: Improve c-api/bytearray.rst with error handling info (GH-122624) (#122659) 2024-08-03 22:02:24 +00:00
bytes.rst [3.12] docs: specify that PyBytes_AsStringAndSize returns 0 on success (GH-110888) (GH-111690) 2023-12-25 20:24:22 +02:00
call.rst [3.12] Add a version added note for PY_VECTORCALL_ARGUMENTS_OFFSET (GH-110963) (#111219) 2023-10-23 16:09:59 +00:00
capsule.rst [3.12] gh-107298: Fix yet more Sphinx warnings in the C API doc (GH-107345) (GH-107380) 2023-07-28 08:20:53 +00:00
cell.rst [3.12] gh-121533: Improve PyCell_[Get,Set] docs: mention the exceptions (GH-121534) (#121540) 2024-07-09 19:03:12 +03:00
code.rst [3.12] Use pep role instead of url (GH-121611) (#124173) 2024-09-17 13:08:38 +00:00
codec.rst [3.12] gh-107298: Fix doc references to undocumented modules (GH-107300) (GH-107370) 2023-07-28 06:17:49 +00:00
complex.rst [3.12] gh-121834: Improve complex C-API docs (GH-121835) (#121897) 2024-07-17 07:30:18 +00:00
concrete.rst GH-97950: Use new-style index directive ('object') (#104158) 2023-05-04 13:04:41 +03:00
contextvars.rst [3.12] gh-115664: Fix ordering of more versionadded and versionchanged directives (GH-116298) (GH-116450) 2024-03-07 08:21:25 +00:00
conversion.rst [3.12] Document PyOS_strtoul and PyOS_strtol (GH-114048) (GH-114618) 2024-01-26 17:50:33 +00: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.12] gh-123517: Remove unnecessary :meth: parentheses (gh-123518) (GH-123576) 2024-09-02 16:02:39 +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.12] Improve some C API documentation (GH-108768) (#108785) 2023-09-02 23:43:41 +02:00
exceptions.rst [3.12] gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) (#124558) 2024-09-25 23:01:19 +00:00
file.rst [3.12] Fix c-api/file.rst indexes (GH-114608) (#124786) 2024-09-30 13:50:33 +00:00
float.rst [3.12] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122013) 2024-07-19 09:08:33 +00:00
frame.rst [3.12] gh-101100: Properly document frame object attributes (GH-112735) (#112772) 2023-12-05 19:34:06 +00:00
function.rst [3.12] gh-130169: Fix broken list markup in Doc/c-api/function.rst (GH-130174) (#130176) 2025-02-16 11:04:07 +00:00
gcsupport.rst [3.12] gh-101100: Fix sphinx warnings in c-api/gcsupport.rst (GH-114786) (#115263) 2024-02-13 14:25:54 -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.12] gh-101100: Fix Sphinx warnings in whatsnew/3.2.rst (GH-115580) (#115589) 2024-02-17 14:18:30 -07:00
import.rst [3.12] gh-101100: Consolidate documentation on ModuleType attributes (#124709) (#125211) 2024-10-09 19:18:38 +00:00
index.rst bpo-36763: Implement the PEP 587 (GH-13592) 2019-05-27 16:39:22 +02:00
init.rst [3.12] gh-101100: Docs: Fix some typos in the document (GH-129988) (#129998) 2025-02-11 23:31:48 +02:00
init_config.rst [3.12] Swap the and from in sentence in init_config.rst (GH-120086) (#123743) 2024-09-05 20:11:25 +00:00
intro.rst [3.12] gh-115172: Fix explicit index extries for the C API (GH-115173) (GH-115292) 2024-02-11 10:34:41 +00:00
iter.rst More minor fixes to C API docs (GH-31525) 2022-04-02 12:31:05 -07:00
iterator.rst [3.12] gh-107298: Fix Sphinx warnings in the C API doc (GH-107302) (GH-107375) 2023-07-28 06:40:16 +00:00
list.rst GH-97950: Use new-style index directive ('builtin') (#104164) 2023-05-06 06:54:08 +03:00
long.rst [3.12] gh-101291: Add versionadded directives for PyUnstable_Long_* (GH-125384) (#125408) 2024-10-13 17:45:59 +00:00
mapping.rst [3.12] Improve some C API documentation (GH-108768) (#108785) 2023-09-02 23:43:41 +02:00
marshal.rst [3.12] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122013) 2024-07-19 09:08:33 +00:00
memory.rst [3.12] gh-115172: Fix explicit index extries for the C API (GH-115173) (GH-115292) 2024-02-11 10:34:41 +00:00
memoryview.rst [3.12] gh-101100: Fix sphinx warnings in Doc/c-api/memoryview.rst (GH-114669) (GH-114704) 2024-01-29 10:02:06 +00:00
method.rst [3.12] gh-107091: Fix the use of some C domain roles (GH-107092) (GH-107113) 2023-07-23 14:50:21 +03:00
module.rst [3.12] gh-101944: Clarify PyModule_AddObjectRef() documentation (GH-129433) (#129613) 2025-02-03 12:02:31 +00:00
none.rst [3.12] gh-107298: Fix yet more Sphinx warnings in the C API doc (GH-107345) (GH-107380) 2023-07-28 08:20:53 +00:00
number.rst [3.12] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122013) 2024-07-19 09:08:33 +00:00
objbuffer.rst bpo-41103: Resurrect the old buffer protocol. (GH-27437) 2021-07-29 12:46:47 +02:00
object.rst [3.12] gh-127954: Document PyObject_DelItemString (GH-127986) (#128497) 2025-01-04 20:54:56 +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.12] Use pep role instead of url (GH-121611) (#124173) 2024-09-17 13:08:38 +00:00
reflection.rst bpo-46836: Add Doc/c-api/frame.rst (GH-32051) 2022-03-23 13:19:13 +01:00
sequence.rst [3.12] gh-101100: Fix some broken sphinx references (GH-107095) (#107103) 2023-07-23 12:00:31 +02:00
set.rst [3.12] gh-101100: Fix Sphinx reference warnings (GH-112416) (#112420) 2023-11-26 05:22:13 -07:00
slice.rst [3.12] gh-121567: Improve slice C-API docs by mentioning exceptions (GH-121568) (#121579) 2024-07-10 11:03:22 +00:00
stable.rst [3.12] gh-127253: Note that Stable ABI is about ABI stability (GH-127254) (GH-127558) 2024-12-03 13:57:58 +01:00
structures.rst [3.12] Fix the PyGetSetDef documentation (GH-116056) (GH-116363) 2024-03-05 16:16:50 +00:00
sys.rst [3.12] gh-101100: Clean up Doc/c-api/exceptions.rst and Doc/c-api/sys.rst (GH-114825) (GH-115308) 2024-02-11 19:02:21 +00:00
tuple.rst [3.12] gh-124182: Explain naming rules for struct sequence types (GH-124335) (#125056) 2024-10-07 17:59:31 +00:00
type.rst [3.12] Docs: Fix incorrect indents in c-api/type.rst (GH-127449) (#127461) 2024-12-01 10:51:46 +02:00
typehints.rst [3.12] gh-107298: Fix Sphinx warnings in the C API doc (GH-107302) (GH-107375) 2023-07-28 06:40:16 +00:00
typeobj.rst [3.12] gh-129912: Fix references to Py_TPFLAGS_MANAGED_DICT (gh-130044) (gh-130060) 2025-02-12 22:55:30 +00:00
unicode.rst [3.12] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130125) 2025-02-17 14:07:59 +01:00
utilities.rst [3.12] gh-101100: Fix Sphinx warnings in whatsnew/3.2.rst (GH-115580) (#115589) 2024-02-17 14:18:30 -07:00
veryhigh.rst [3.12] gh-115172: Fix explicit index extries for the C API (GH-115173) (GH-115292) 2024-02-11 10:34:41 +00:00
weakref.rst [3.12] docs: fix a few typos identified by codespell (GH-119516) (#119571) 2024-05-26 08:15:57 +00:00