cpython/Objects
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
..
clinic [3.12] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130125) 2025-02-17 14:07:59 +01:00
stringlib gh-99537: Use Py_SETREF() function in C code (#99657) 2022-11-22 13:39:11 +01:00
abstract.c GH-101291: Rearrange the size bits in PyLongObject (GH-102464) 2023-03-22 14:49:51 +00:00
boolobject.c [3.12] gh-122982: Extend the deprecation period for bool inversion by two years (GH-123306) (#123317) 2024-08-25 19:40:11 +00:00
bytearrayobject.c [3.12] gh-112625: Protect bytearray from being freed by misbehaving iterator inside bytearray.join (GH-112626) (GH-112693) 2023-12-04 08:46:40 +00:00
bytes_methods.c gh-84436: Implement Immortal Objects (gh-19474) 2023-04-22 13:39:37 -06:00
bytesobject.c [3.12] gh-105235: Prevent reading outside buffer during mmap.find() (GH-105252) (#106708) 2023-07-14 22:15:14 -04:00
call.c GH-103899: Provide a hint when accidentally calling a module (GH-103900) 2023-05-04 15:07:42 -07:00
capsule.c gh-99537: Use Py_SETREF() function in C code (#99657) 2022-11-22 13:39:11 +01:00
cellobject.c gh-99300: Use Py_NewRef() in Objects/ directory (#99332) 2022-11-10 16:27:32 +01:00
classobject.c [3.12] GH-106895: Raise a ValueError when attempting to disable events that cannot be disabled. (GH-107337) (GH-107351) 2023-07-28 10:53:33 +01:00
codeobject.c [3.12] gh-113993: Make interned strings mortal (GH-120520, GH-121364, GH-121903, GH-122303) (#123065) 2024-09-27 13:28:48 -07:00
complexobject.c [3.12] gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211) (GH-127216) (GH-127530) 2024-12-02 19:47:42 +00:00
descrobject.c [3.12] bpo-24766: doc= argument to subclasses of property not handled correctly (GH-2487) (GH-120312) 2024-06-10 10:32:45 +00: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.12] gh-127563: use dk_log2_index_bytes=3 in empty dicts (GH-127568) (GH-127813) 2024-12-12 12:50:51 +01:00
enumobject.c gh-99300: Use Py_NewRef() in Objects/ directory (#99335) 2022-11-10 22:22:02 +01:00
exception_handling_notes.txt gh-96455: update example in exception_handling_notes.txt to the 3.11RC bytecode (GH-96456) 2022-09-01 14:21:39 +01:00
exceptions.c [3.12] gh-123378: fix a crash in UnicodeError.__str__ (GH-124935) (#125098) 2024-10-08 11:56:18 +00:00
fileobject.c gh-99537: Use Py_SETREF(var, NULL) in C code (#99687) 2022-11-23 14:57:50 +01:00
floatobject.c [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_layout.md GH-96421: Insert shim frame on entry to interpreter (GH-96319) 2022-11-10 12:34:57 +00:00
frameobject.c [3.12] GH-94438: Restore ability to jump over None tests (GH-111243) 2023-10-24 06:39:26 +00:00
funcobject.c [3.12] gh-106033: Get rid of PyDict_GetItem in _PyFunction_FromConstructor (GH-106044) (GH-106228) 2023-06-29 13:45:39 +03:00
genericaliasobject.c [3.12] gh-121660: Fix ga_getitem by explicitly checking for NULL result (GH-121661) (#121762) 2024-07-14 11:37:00 +00:00
genobject.c [3.12] gh-128078: Use PyErr_SetRaisedException in _PyGen_SetStopIterationValue (GH-128287) (#128790) 2025-02-04 00:28:14 +01:00
interpreteridobject.c [3.12] gh-101524: Only Use Public C-API in the _xxsubinterpreters Module (gh-105258) (gh-107303) 2023-07-27 13:15:47 -06:00
iterobject.c [3.12] gh-128078: Clear exception in anext before calling _PyGen_SetStopIterationValue (GH-128780) (#128784) 2025-01-13 18:45:20 +05:30
listobject.c [3.12] gh-120384: Fix array-out-of-bounds crash in list_ass_subscript (GH-120442) (#120825) 2024-06-21 11:08:22 +00:00
listsort.txt Fix typos in the Objects directory (GH-28766) 2021-10-06 16:57:10 -07:00
lnotab_notes.txt [3.12] Document the co_lines method on code objects (#113682) (#113686) 2024-01-03 20:09:15 +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.12] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122013) 2024-07-19 09:08:33 +00:00
memoryobject.c [3.12] gh-126341: add release check to __iter__ method of memoryview (GH-126759) (#126779) 2024-11-13 20:44:01 +02:00
methodobject.c gh-99300: Use Py_NewRef() in Objects/ directory (#99354) 2022-11-10 23:58:07 +01:00
moduleobject.c [3.12] gh-106719: Fix __annotations__ getter and setter in the type and module types (GH-106720) (GH-106848) 2023-07-18 10:01:22 +03:00
namespaceobject.c [3.12] gh-128198: Add missing error checks for usages of PyIter_Next() (GH-128199) (GH-128273) 2024-12-26 10:38:48 +00:00
object.c [3.12] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-125205) 2024-12-03 10:26:25 -07:00
object_layout.md [3.12] gh-106293: Fix typos in Objects/object_layout.md (GH-106294) (#114158) 2024-01-16 23:35:20 +00:00
object_layout_312.gv GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +01:00
object_layout_312.png GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +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
obmalloc.c [3.12] gh-100227: Lock Around Modification of the Global Allocators State (gh-105516) (gh-105532) 2023-06-08 22:35:53 +00:00
odictobject.c [3.12] gh-119004: fix a crash in equality testing between OrderedDict (GH-121329) (#124508) 2024-09-27 11:33:44 -07:00
picklebufobject.c gh-91118: Fix docstrings that do not honor --without-doc-strings (#31769) 2022-04-17 20:39:32 -07:00
rangeobject.c GH-101291: Rearrange the size bits in PyLongObject (GH-102464) 2023-03-22 14:49:51 +00:00
README
setobject.c [3.12] gh-113560: Improve docstrings for set.issubset() and set.issuperset() (GH-113562) (GH-114644) 2024-01-27 11:29:26 +00:00
sliceobject.c gh-84436: Implement Immortal Objects (gh-19474) 2023-04-22 13:39:37 -06:00
structseq.c [3.12] gh-122527: Fix a crash on deallocation of PyStructSequence (GH-122577) (#122626) 2024-09-06 15:46:56 +02:00
tupleobject.c [3.12] GH-121439: Allow PyTupleObjects with an ob_size of 20 in the free_list to be reused (gh-121428) (#121566) 2024-07-10 08:06:41 +00:00
typeobject.c [3.12] gh-126862: Use Py_ssize_t instead of int when processing the number of super-classes (GH-127523) (#128700) 2025-01-10 03:51:45 +00: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.12] gh-124498: Fix TypeAliasType not to be generic, when type_params=() (GH-124499) (#124604) 2024-09-26 14:46:29 +00:00
unicodectype.c [3.12] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130125) 2025-02-17 14:07:59 +01:00
unicodeobject.c [3.12] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130125) 2025-02-17 14:07:59 +01:00
unicodetype_db.h bpo-47243: Duplicate entry in 'Objects/unicodetype_db.h' (GH-32376) 2022-09-28 06:57:14 -07:00
unionobject.c gh-104549: Set __module__ on TypeAliasType (#104550) 2023-05-18 15:56:15 -07:00
weakrefobject.c gh-94673: Properly Initialize and Finalize Static Builtin Types for Each Interpreter (gh-104072) 2023-05-01 19:36:00 -06:00

Source files for various builtin objects