Skip to content

Commit d7507dd

Browse files
committed
gh-106320: Remove private _PyLong converter functions
Move private functions to the internal C API (pycore_traceback.h): Argument Clinic now emits #include "pycore_long.h" when using these functions.
1 parent 73d33c1 commit d7507dd

File tree

12 files changed

+33
-13
lines changed

12 files changed

+33
-13
lines changed

Include/cpython/longobject.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
PyAPI_FUNC(int) _PyLong_UnsignedShort_Converter(PyObject *, void *);
6-
PyAPI_FUNC(int) _PyLong_UnsignedInt_Converter(PyObject *, void *);
7-
PyAPI_FUNC(int) _PyLong_UnsignedLong_Converter(PyObject *, void *);
8-
PyAPI_FUNC(int) _PyLong_UnsignedLongLong_Converter(PyObject *, void *);
95
PyAPI_FUNC(int) _PyLong_Size_t_Converter(PyObject *, void *);
106

117
PyAPI_FUNC(PyObject*) PyLong_FromUnicodeObject(PyObject *u, int base);

Include/internal/pycore_long.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ extern char* _PyLong_FormatBytesWriter(
186186
int base,
187187
int alternate);
188188

189+
// Argument converters used by Argument Clinic
190+
PyAPI_FUNC(int) _PyLong_UnsignedShort_Converter(PyObject *, void *);
191+
PyAPI_FUNC(int) _PyLong_UnsignedInt_Converter(PyObject *, void *);
192+
PyAPI_FUNC(int) _PyLong_UnsignedLong_Converter(PyObject *, void *);
193+
PyAPI_FUNC(int) _PyLong_UnsignedLongLong_Converter(PyObject *, void *);
194+
195+
189196
/* Long value tag bits:
190197
* 0-1: Sign bits value = (1-sign), ie. negative=2, positive=0, zero=1.
191198
* 2: Reserved for immortality bit

Modules/_blake2/clinic/blake2b_impl.c.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_blake2/clinic/blake2s_impl.c.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_testclinic.c.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_testclinic_depr.c.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/overlapped.c.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/posixmodule.c.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/selectmodule.c.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/sha3module.c.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PC/clinic/winreg.c.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/clinic/clinic.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3613,6 +3613,8 @@ def converter_init(self, *, bitwise: bool = False) -> None:
36133613
self.format_unit = 'H'
36143614
else:
36153615
self.converter = '_PyLong_UnsignedShort_Converter'
3616+
self.add_include('pycore_long.h',
3617+
'_PyLong_UnsignedShort_Converter()')
36163618

36173619
def parse_arg(self, argname: str, displayname: str) -> str | None:
36183620
if self.format_unit == 'H':
@@ -3674,6 +3676,8 @@ def converter_init(self, *, bitwise: bool = False) -> None:
36743676
self.format_unit = 'I'
36753677
else:
36763678
self.converter = '_PyLong_UnsignedInt_Converter'
3679+
self.add_include('pycore_long.h',
3680+
'_PyLong_UnsignedInt_Converter()')
36773681

36783682
def parse_arg(self, argname: str, displayname: str) -> str | None:
36793683
if self.format_unit == 'I':
@@ -3711,6 +3715,8 @@ def converter_init(self, *, bitwise: bool = False) -> None:
37113715
self.format_unit = 'k'
37123716
else:
37133717
self.converter = '_PyLong_UnsignedLong_Converter'
3718+
self.add_include('pycore_long.h',
3719+
'_PyLong_UnsignedLong_Converter()')
37143720

37153721
def parse_arg(self, argname: str, displayname: str) -> str | None:
37163722
if self.format_unit == 'k':
@@ -3750,6 +3756,8 @@ def converter_init(self, *, bitwise: bool = False) -> None:
37503756
self.format_unit = 'K'
37513757
else:
37523758
self.converter = '_PyLong_UnsignedLongLong_Converter'
3759+
self.add_include('pycore_long.h',
3760+
'_PyLong_UnsignedLongLong_Converter()')
37533761

37543762
def parse_arg(self, argname: str, displayname: str) -> str | None:
37553763
if self.format_unit == 'K':

0 commit comments

Comments
 (0)