Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Include/cpython/longobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# error "this header file must not be included directly"
#endif

PyAPI_FUNC(int) _PyLong_UnsignedShort_Converter(PyObject *, void *);
PyAPI_FUNC(int) _PyLong_UnsignedInt_Converter(PyObject *, void *);
PyAPI_FUNC(int) _PyLong_UnsignedLong_Converter(PyObject *, void *);
PyAPI_FUNC(int) _PyLong_UnsignedLongLong_Converter(PyObject *, void *);
PyAPI_FUNC(int) _PyLong_Size_t_Converter(PyObject *, void *);

PyAPI_FUNC(PyObject*) PyLong_FromUnicodeObject(PyObject *u, int base);
Expand Down
7 changes: 7 additions & 0 deletions Include/internal/pycore_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ extern char* _PyLong_FormatBytesWriter(
int base,
int alternate);

// Argument converters used by Argument Clinic
PyAPI_FUNC(int) _PyLong_UnsignedShort_Converter(PyObject *, void *);
PyAPI_FUNC(int) _PyLong_UnsignedInt_Converter(PyObject *, void *);
PyAPI_FUNC(int) _PyLong_UnsignedLong_Converter(PyObject *, void *);
PyAPI_FUNC(int) _PyLong_UnsignedLongLong_Converter(PyObject *, void *);


/* Long value tag bits:
* 0-1: Sign bits value = (1-sign), ie. negative=2, positive=0, zero=1.
* 2: Reserved for immortality bit
Expand Down
3 changes: 2 additions & 1 deletion Modules/_blake2/clinic/blake2b_impl.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Modules/_blake2/clinic/blake2s_impl.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Modules/clinic/_testclinic.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Modules/clinic/_testclinic_depr.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Modules/clinic/overlapped.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Modules/clinic/posixmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Modules/clinic/selectmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Modules/clinic/sha3module.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Modules/overlapped.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
/* XXX check overflow and DWORD <-> Py_ssize_t conversions
Check itemsize */

#include "Python.h"
#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
#endif

#include "Python.h"

#define WINDOWS_LEAN_AND_MEAN
#include <winsock2.h>
Expand Down
3 changes: 2 additions & 1 deletion PC/clinic/winreg.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Tools/c-analyzer/c_parser/preprocessor/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@
# macro. Usually it's defined by the C file which includes it.
# Other header files have a similar issue.
NEED_BUILD_CORE = {
# Header ".h" files
'cjkcodecs.h',
'multibytecodec.h',
'socketmodule.h',

# Argument Clinic ".c.h" files
'_testclinic.c.h',
'_testclinic_depr.c.h',
'overlapped.c.h',
'posixmodule.c.h',
'selectmodule.c.h',
'sha3module.c.h',
}

TOOL = 'gcc'
Expand Down
8 changes: 8 additions & 0 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3629,6 +3629,8 @@ def converter_init(self, *, bitwise: bool = False) -> None:
self.format_unit = 'H'
else:
self.converter = '_PyLong_UnsignedShort_Converter'
self.add_include('pycore_long.h',
'_PyLong_UnsignedShort_Converter()')

def parse_arg(self, argname: str, displayname: str) -> str | None:
if self.format_unit == 'H':
Expand Down Expand Up @@ -3690,6 +3692,8 @@ def converter_init(self, *, bitwise: bool = False) -> None:
self.format_unit = 'I'
else:
self.converter = '_PyLong_UnsignedInt_Converter'
self.add_include('pycore_long.h',
'_PyLong_UnsignedInt_Converter()')

def parse_arg(self, argname: str, displayname: str) -> str | None:
if self.format_unit == 'I':
Expand Down Expand Up @@ -3727,6 +3731,8 @@ def converter_init(self, *, bitwise: bool = False) -> None:
self.format_unit = 'k'
else:
self.converter = '_PyLong_UnsignedLong_Converter'
self.add_include('pycore_long.h',
'_PyLong_UnsignedLong_Converter()')

def parse_arg(self, argname: str, displayname: str) -> str | None:
if self.format_unit == 'k':
Expand Down Expand Up @@ -3766,6 +3772,8 @@ def converter_init(self, *, bitwise: bool = False) -> None:
self.format_unit = 'K'
else:
self.converter = '_PyLong_UnsignedLongLong_Converter'
self.add_include('pycore_long.h',
'_PyLong_UnsignedLongLong_Converter()')

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