From 64508fc6d611839f55d82ef7c3f64d41825b55f7 Mon Sep 17 00:00:00 2001 From: moneebullah25 Date: Wed, 14 Jan 2026 12:26:53 -0500 Subject: [PATCH 1/3] gh-143834: Fix PyLong_AsNativeBytes docs for negative number padding --- Doc/c-api/long.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 6834c872c8cfcd..cca95feb8e3fc1 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -453,8 +453,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. Otherwise, returns the number of bytes required to store the value. If this is equal to or less than *n_bytes*, the entire value was copied. - All *n_bytes* of the buffer are written: large buffers are padded with - zeroes. + All *n_bytes* of the buffer are written: remaining bytes filled by copies of the sign bit. If the returned value is greater than *n_bytes*, the value was truncated: as many of the lowest bits of the value as could fit are written, From e73b60f1263647dca90e3ad2bd99d1003af6a7d0 Mon Sep 17 00:00:00 2001 From: moneebullah25 Date: Wed, 14 Jan 2026 12:31:55 -0500 Subject: [PATCH 2/3] gh-143834: Fix PyLong_AsNativeBytes docs for negative number padding --- Doc/c-api/long.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index cca95feb8e3fc1..c1fbf19e69e4c2 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -453,7 +453,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. Otherwise, returns the number of bytes required to store the value. If this is equal to or less than *n_bytes*, the entire value was copied. - All *n_bytes* of the buffer are written: remaining bytes filled by copies of the sign bit. + All *n_bytes* of the buffer are written: remaining bytes filled by + copies of the sign bit. If the returned value is greater than *n_bytes*, the value was truncated: as many of the lowest bits of the value as could fit are written, From 1d81b04274b81c7781ec8c3270d4018d1df00564 Mon Sep 17 00:00:00 2001 From: moneebullah25 Date: Wed, 14 Jan 2026 12:34:52 -0500 Subject: [PATCH 3/3] lint fix --- Doc/c-api/long.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index c1fbf19e69e4c2..ed9b37dc1721f2 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -453,7 +453,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. Otherwise, returns the number of bytes required to store the value. If this is equal to or less than *n_bytes*, the entire value was copied. - All *n_bytes* of the buffer are written: remaining bytes filled by + All *n_bytes* of the buffer are written: remaining bytes filled by copies of the sign bit. If the returned value is greater than *n_bytes*, the value was