cpython/Objects
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
..
clinic [3.13] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130127) 2025-02-17 15:02:39 +01:00
mimalloc [3.13] Fix typos (#123775) (#123866) 2024-10-07 23:44:31 +02:00
stringlib gh-117431: Adapt bytes and bytearray .find() and friends to Argument Clinic (#117502) 2024-04-12 07:40:55 +00:00
abstract.c gh-116316: Fix typo in UNARY_FUNC(PyNumber_Positive) macros (GH-116317) 2024-03-04 17:57:01 +00:00
boolobject.c [3.13] gh-122982: Extend the deprecation period for bool inversion by two years (GH-123306) (#123316) 2024-08-25 19:48:34 +00:00
bytearrayobject.c [3.13] gh-126980: Fix bytearray.__buffer__ crash on PyBUF_{READ,WRITE} (GH-126981) (#127023) 2024-11-19 20:37:53 +03:00
bytes_methods.c gh-117431: Adapt bytes and bytearray .find() and friends to Argument Clinic (#117502) 2024-04-12 07:40:55 +00:00
bytesobject.c [3.13] gh-128133: use relaxed atomics for hash of bytes (GH-128412) (#130022) 2025-02-12 02:45:02 +01:00
call.c gh-106320: Remove _PyFunction_Vectorcall() API (#107071) 2023-07-22 21:44:33 +00:00
capsule.c [3.13] gh-124538: Fix crash when using gc.get_referents on an untracked capsule object (GH-124559) (#124588) 2024-09-26 13:51:58 -07:00
cellobject.c gh-117323: Make cell thread-safe in free-threaded builds (#117330) 2024-03-29 13:35:43 -04:00
classobject.c gh-118362: Fix thread safety around lookups from the type cache in the face of concurrent mutators (#118454) 2024-05-06 10:50:35 -07:00
codeobject.c [3.13] gh-127582: Make object resurrection thread-safe for free threading. (GH-127612) (GH-127659) 2024-12-05 18:49:33 -05:00
complexobject.c [3.13] gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211) (#127216) 2024-12-02 15:42:02 +01:00
descrobject.c [3.13] bpo-24766: doc= argument to subclasses of property not handled correctly (GH-2487) (GH-120305) 2024-06-11 12:52:27 +03:00
dictnotes.txt bpo-46845: Reduce dict size when all keys are Unicode (GH-31564) 2022-03-02 08:09:28 +09:00
dictobject.c [3.13] gh-117657: Fix data race in dict_dict_merge (gh-129755) (gh-129808) 2025-02-07 10:18:57 -05:00
enumobject.c gh-106320: Create pycore_modsupport.h header file (#106355) 2023-07-03 09:39:11 +00:00
exception_handling_notes.txt GH-105848: Simplify the arrangement of CALL's stack (GH-107788) 2023-08-09 18:19:39 +00:00
exceptions.c [3.13] gh-129668: Fix thread-safety of MemoryError freelist in free threaded build (gh-129704) (gh-129742) 2025-02-06 13:27:30 -05:00
fileobject.c gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() (GH-117160) 2024-03-25 16:32:11 +01:00
floatobject.c [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_layout.md gh-109094: replace frame->prev_instr by frame->instr_ptr (#109095) 2023-10-26 13:43:10 +00:00
frameobject.c [3.13] gh-128198: Add missing error checks for usages of PyIter_Next() (GH-128199) (GH-128272) 2024-12-26 10:39:47 +00:00
funcobject.c [3.13] gh-127582: Make object resurrection thread-safe for free threading. (GH-127612) (GH-127659) 2024-12-05 18:49:33 -05:00
genericaliasobject.c [3.13] gh-121660: Fix ga_getitem by explicitly checking for NULL result (GH-121661) (#121761) 2024-07-14 11:48:33 +00:00
genobject.c [3.13] gh-128078: Use PyErr_SetRaisedException in _PyGen_SetStopIterationValue (GH-128287) (#128789) 2025-02-04 00:34:02 +01:00
iterobject.c [3.13] gh-128078: Clear exception in anext before calling _PyGen_SetStopIterationValue (GH-128780) (#128785) 2025-01-13 13:20:49 +00:00
listobject.c [3.13] gh-129643: Fix PyList_Insert in free-threading builds (GH-129680) (#129725) 2025-02-06 13:22:41 +00:00
listsort.txt GH-116939: Rewrite binarysort() (#116940) 2024-03-21 22:27:25 -05:00
lnotab_notes.txt Document the co_lines method on code objects (#113682) 2024-01-03 19:29:24 +00:00
locations.md GH-88116: Use a compact format to represent end line and column offsets. (GH-91666) 2022-04-21 16:10:37 +01:00
longobject.c [3.13] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122012) 2024-07-19 09:13:08 +00:00
memoryobject.c [3.13] gh-126341: add release check to __iter__ method of memoryview (GH-126759) (#126778) 2024-11-13 19:05:59 +00:00
methodobject.c gh-113024: C API: Add PyObject_GenericHash() function (GH-113025) 2024-03-22 20:19:10 +02:00
moduleobject.c [3.13] gh-123930: Better error for "from imports" when script shadows module (GH-123929) (#125937) 2024-10-24 19:37:31 +00:00
namespaceobject.c [3.13] gh-128198: Add missing error checks for usages of PyIter_Next() (GH-128199) (GH-128272) 2024-12-26 10:39:47 +00:00
object.c [3.13] gh-128100: Use atomic dictionary load in _PyObject_GenericGetAttrWithDict (GH-128297) (GH-129979) 2025-02-10 20:48:24 +00:00
object_layout.md GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_312.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_312.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_313.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_313.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_full_312.gv GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +01:00
object_layout_full_312.png GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +01:00
object_layout_full_313.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_full_313.png GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
obmalloc.c [3.13] gh-121460: Skip freeing unallocated arenas (gh-121589) 2024-07-10 17:05:11 +00:00
odictobject.c [3.13] gh-119004: fix a crash in equality testing between OrderedDict (GH-121329) (#124507) 2024-09-27 11:34:48 -07:00
picklebufobject.c gh-104922: remove PY_SSIZE_T_CLEAN (#106315) 2023-07-02 15:07:46 +09:00
rangeobject.c gh-117764: Fix and add signatures for many builtins (GH-117769) 2024-04-12 13:56:41 +03:00
README
setobject.c [3.13] gh-129967: Fix race condition in repr(set) (gh-129978) (gh-130020) 2025-02-11 18:18:12 -05:00
sliceobject.c gh-117764: Add docstrings and signatures for the types of None, Ellipsis and NotImplemented (GH-117813) 2024-04-12 15:45:23 +03:00
structseq.c [3.13] gh-123091: Use more _Py_IsImmortalLoose() (GH-123602) (GH-123622) 2024-09-03 12:36:42 +02:00
tupleobject.c [3.13] gh-126076: Account for relocated objects in tracemalloc (GH-126077) (#127823) 2024-12-11 14:15:37 +01:00
typeobject.c [3.13] gh-128759: Fix accesses to tp_version_tag. (GH-129750) (GH-130042) 2025-02-12 10:43:25 -05:00
typeslots.inc bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931) 2020-11-10 12:53:46 -08:00
typeslots.py bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931) 2020-11-10 12:53:46 -08:00
typevarobject.c [3.13] gh-124498: Fix TypeAliasType not to be generic, when type_params=() (GH-124499) (#124603) 2024-09-29 18:01:06 -07:00
unicodectype.c [3.13] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130127) 2025-02-17 15:02:39 +01:00
unicodeobject.c [3.13] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130127) 2025-02-17 15:02:39 +01:00
unicodetype_db.h gh-96954: Fix make regen-unicodedata in out-of-tree builds (#112118) 2023-11-15 16:42:17 +00:00
unionobject.c gh-108511: Add C API functions which do not silently ignore errors (GH-109025) 2023-09-17 14:23:31 +03:00
weakrefobject.c [3.13] gh-121652: Handle allocate_weakref returning NULL (GH-121653) (#121721) 2024-07-13 16:31:50 +00:00

Source files for various builtin objects