mirror of https://github.com/python/cpython
gh-107211: No longer export internal functions (3) (#107215)
No longer export these 14 internal C API functions: * _PySys_Audit() * _PySys_SetAttr() * _PyTraceBack_FromFrame() * _PyTraceBack_Print_Indented() * _PyUnicode_FormatAdvancedWriter() * _PyUnicode_ScanIdentifier() * _PyWarnings_Init() * _Py_DumpASCII() * _Py_DumpDecimal() * _Py_DumpHexadecimal() * _Py_DumpTraceback() * _Py_DumpTracebackThreads() * _Py_WriteIndent() * _Py_WriteIndentedMargin()
This commit is contained in:
parent
5a61692c6c
commit
0d0520af83
|
@ -8,7 +8,7 @@ extern "C" {
|
||||||
# error "this header requires Py_BUILD_CORE define"
|
# error "this header requires Py_BUILD_CORE define"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyAPI_FUNC(int) _PySys_Audit(
|
extern int _PySys_Audit(
|
||||||
PyThreadState *tstate,
|
PyThreadState *tstate,
|
||||||
const char *event,
|
const char *event,
|
||||||
const char *argFormat,
|
const char *argFormat,
|
||||||
|
@ -18,7 +18,7 @@ PyAPI_FUNC(int) _PySys_Audit(
|
||||||
PyAPI_FUNC() to not export the symbol. */
|
PyAPI_FUNC() to not export the symbol. */
|
||||||
extern void _PySys_ClearAuditHooks(PyThreadState *tstate);
|
extern void _PySys_ClearAuditHooks(PyThreadState *tstate);
|
||||||
|
|
||||||
PyAPI_FUNC(int) _PySys_SetAttr(PyObject *, PyObject *);
|
extern int _PySys_SetAttr(PyObject *, PyObject *);
|
||||||
|
|
||||||
extern int _PySys_ClearAttrString(PyInterpreterState *interp,
|
extern int _PySys_ClearAttrString(PyInterpreterState *interp,
|
||||||
const char *name, int verbose);
|
const char *name, int verbose);
|
||||||
|
|
|
@ -324,10 +324,12 @@ extern int _PyTime_GetPerfCounterWithInfo(
|
||||||
|
|
||||||
// Create a deadline.
|
// Create a deadline.
|
||||||
// Pseudo code: _PyTime_GetMonotonicClock() + timeout.
|
// Pseudo code: _PyTime_GetMonotonicClock() + timeout.
|
||||||
|
// Export for '_ssl' shared extension.
|
||||||
PyAPI_FUNC(_PyTime_t) _PyDeadline_Init(_PyTime_t timeout);
|
PyAPI_FUNC(_PyTime_t) _PyDeadline_Init(_PyTime_t timeout);
|
||||||
|
|
||||||
// Get remaining time from a deadline.
|
// Get remaining time from a deadline.
|
||||||
// Pseudo code: deadline - _PyTime_GetMonotonicClock().
|
// Pseudo code: deadline - _PyTime_GetMonotonicClock().
|
||||||
|
// Export for '_ssl' shared extension.
|
||||||
PyAPI_FUNC(_PyTime_t) _PyDeadline_Get(_PyTime_t deadline);
|
PyAPI_FUNC(_PyTime_t) _PyDeadline_Get(_PyTime_t deadline);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
||||||
|
|
||||||
This function is signal safe. */
|
This function is signal safe. */
|
||||||
|
|
||||||
PyAPI_FUNC(void) _Py_DumpTraceback(
|
extern void _Py_DumpTraceback(
|
||||||
int fd,
|
int fd,
|
||||||
PyThreadState *tstate);
|
PyThreadState *tstate);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ PyAPI_FUNC(void) _Py_DumpTraceback(
|
||||||
|
|
||||||
This function is signal safe. */
|
This function is signal safe. */
|
||||||
|
|
||||||
PyAPI_FUNC(const char*) _Py_DumpTracebackThreads(
|
extern const char* _Py_DumpTracebackThreads(
|
||||||
int fd,
|
int fd,
|
||||||
PyInterpreterState *interp,
|
PyInterpreterState *interp,
|
||||||
PyThreadState *current_tstate);
|
PyThreadState *current_tstate);
|
||||||
|
@ -64,23 +64,23 @@ PyAPI_FUNC(const char*) _Py_DumpTracebackThreads(
|
||||||
string which is not ready (PyUnicode_WCHAR_KIND).
|
string which is not ready (PyUnicode_WCHAR_KIND).
|
||||||
|
|
||||||
This function is signal safe. */
|
This function is signal safe. */
|
||||||
PyAPI_FUNC(void) _Py_DumpASCII(int fd, PyObject *text);
|
extern void _Py_DumpASCII(int fd, PyObject *text);
|
||||||
|
|
||||||
/* Format an integer as decimal into the file descriptor fd.
|
/* Format an integer as decimal into the file descriptor fd.
|
||||||
|
|
||||||
This function is signal safe. */
|
This function is signal safe. */
|
||||||
PyAPI_FUNC(void) _Py_DumpDecimal(
|
extern void _Py_DumpDecimal(
|
||||||
int fd,
|
int fd,
|
||||||
size_t value);
|
size_t value);
|
||||||
|
|
||||||
/* Format an integer as hexadecimal with width digits into fd file descriptor.
|
/* Format an integer as hexadecimal with width digits into fd file descriptor.
|
||||||
The function is signal safe. */
|
The function is signal safe. */
|
||||||
PyAPI_FUNC(void) _Py_DumpHexadecimal(
|
extern void _Py_DumpHexadecimal(
|
||||||
int fd,
|
int fd,
|
||||||
uintptr_t value,
|
uintptr_t value,
|
||||||
Py_ssize_t width);
|
Py_ssize_t width);
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject*) _PyTraceBack_FromFrame(
|
extern PyObject* _PyTraceBack_FromFrame(
|
||||||
PyObject *tb_next,
|
PyObject *tb_next,
|
||||||
PyFrameObject *frame);
|
PyFrameObject *frame);
|
||||||
|
|
||||||
|
@ -89,11 +89,11 @@ PyAPI_FUNC(PyObject*) _PyTraceBack_FromFrame(
|
||||||
|
|
||||||
/* Write the traceback tb to file f. Prefix each line with
|
/* Write the traceback tb to file f. Prefix each line with
|
||||||
indent spaces followed by the margin (if it is not NULL). */
|
indent spaces followed by the margin (if it is not NULL). */
|
||||||
PyAPI_FUNC(int) _PyTraceBack_Print_Indented(
|
extern int _PyTraceBack_Print_Indented(
|
||||||
PyObject *tb, int indent, const char* margin,
|
PyObject *tb, int indent, const char* margin,
|
||||||
const char *header_margin, const char *header, PyObject *f);
|
const char *header_margin, const char *header, PyObject *f);
|
||||||
PyAPI_FUNC(int) _Py_WriteIndentedMargin(int, const char*, PyObject *);
|
extern int _Py_WriteIndentedMargin(int, const char*, PyObject *);
|
||||||
PyAPI_FUNC(int) _Py_WriteIndent(int, PyObject *);
|
extern int _Py_WriteIndent(int, PyObject *);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,14 +117,16 @@ struct _tracemalloc_runtime_state {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Get the traceback where a memory block was allocated.
|
// Get the traceback where a memory block was allocated.
|
||||||
|
//
|
||||||
Return a tuple of (filename: str, lineno: int) tuples.
|
// Return a tuple of (filename: str, lineno: int) tuples.
|
||||||
|
//
|
||||||
Return None if the tracemalloc module is disabled or if the memory block
|
// Return None if the tracemalloc module is disabled or if the memory block
|
||||||
is not tracked by tracemalloc.
|
// is not tracked by tracemalloc.
|
||||||
|
//
|
||||||
Raise an exception and return NULL on error. */
|
// Raise an exception and return NULL on error.
|
||||||
|
//
|
||||||
|
// Export for '_testinternalcapi' shared extension.
|
||||||
PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback(
|
PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback(
|
||||||
unsigned int domain,
|
unsigned int domain,
|
||||||
uintptr_t ptr);
|
uintptr_t ptr);
|
||||||
|
|
|
@ -114,6 +114,7 @@ extern static_builtin_state * _PyStaticType_GetState(PyInterpreterState *, PyTyp
|
||||||
extern void _PyStaticType_ClearWeakRefs(PyInterpreterState *, PyTypeObject *type);
|
extern void _PyStaticType_ClearWeakRefs(PyInterpreterState *, PyTypeObject *type);
|
||||||
extern void _PyStaticType_Dealloc(PyInterpreterState *, PyTypeObject *);
|
extern void _PyStaticType_Dealloc(PyInterpreterState *, PyTypeObject *);
|
||||||
|
|
||||||
|
// Export for 'math' shared extension
|
||||||
PyAPI_FUNC(PyObject *) _PyType_GetDict(PyTypeObject *);
|
PyAPI_FUNC(PyObject *) _PyType_GetDict(PyTypeObject *);
|
||||||
extern PyObject * _PyType_GetBases(PyTypeObject *type);
|
extern PyObject * _PyType_GetBases(PyTypeObject *type);
|
||||||
extern PyObject * _PyType_GetMRO(PyTypeObject *type);
|
extern PyObject * _PyType_GetMRO(PyTypeObject *type);
|
||||||
|
|
|
@ -187,7 +187,7 @@ _PyUnicodeWriter_Dealloc(_PyUnicodeWriter *writer);
|
||||||
|
|
||||||
/* Format the object based on the format_spec, as defined in PEP 3101
|
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||||
(Advanced String Formatting). */
|
(Advanced String Formatting). */
|
||||||
PyAPI_FUNC(int) _PyUnicode_FormatAdvancedWriter(
|
extern int _PyUnicode_FormatAdvancedWriter(
|
||||||
_PyUnicodeWriter *writer,
|
_PyUnicodeWriter *writer,
|
||||||
PyObject *obj,
|
PyObject *obj,
|
||||||
PyObject *format_spec,
|
PyObject *format_spec,
|
||||||
|
@ -245,8 +245,9 @@ extern PyObject* _PyUnicode_DecodeUnicodeEscapeStateful(
|
||||||
const char *errors, /* error handling */
|
const char *errors, /* error handling */
|
||||||
Py_ssize_t *consumed); /* bytes consumed */
|
Py_ssize_t *consumed); /* bytes consumed */
|
||||||
|
|
||||||
/* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape
|
// Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape
|
||||||
chars. */
|
// chars.
|
||||||
|
// Export for test_peg_generator.
|
||||||
PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeInternal(
|
PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeInternal(
|
||||||
const char *string, /* Unicode-Escape encoded string */
|
const char *string, /* Unicode-Escape encoded string */
|
||||||
Py_ssize_t length, /* size of string */
|
Py_ssize_t length, /* size of string */
|
||||||
|
@ -369,6 +370,7 @@ PyAPI_FUNC(int) _PyUnicode_Equal(PyObject *, PyObject *);
|
||||||
extern int _PyUnicode_WideCharString_Converter(PyObject *, void *);
|
extern int _PyUnicode_WideCharString_Converter(PyObject *, void *);
|
||||||
extern int _PyUnicode_WideCharString_Opt_Converter(PyObject *, void *);
|
extern int _PyUnicode_WideCharString_Opt_Converter(PyObject *, void *);
|
||||||
|
|
||||||
|
// Export for test_peg_generator
|
||||||
PyAPI_FUNC(Py_ssize_t) _PyUnicode_ScanIdentifier(PyObject *);
|
PyAPI_FUNC(Py_ssize_t) _PyUnicode_ScanIdentifier(PyObject *);
|
||||||
|
|
||||||
/* --- Runtime lifecycle -------------------------------------------------- */
|
/* --- Runtime lifecycle -------------------------------------------------- */
|
||||||
|
|
|
@ -19,7 +19,7 @@ struct _warnings_runtime_state {
|
||||||
|
|
||||||
extern int _PyWarnings_InitState(PyInterpreterState *interp);
|
extern int _PyWarnings_InitState(PyInterpreterState *interp);
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject*) _PyWarnings_Init(void);
|
extern PyObject* _PyWarnings_Init(void);
|
||||||
|
|
||||||
extern void _PyErr_WarnUnawaitedCoroutine(PyObject *coro);
|
extern void _PyErr_WarnUnawaitedCoroutine(PyObject *coro);
|
||||||
extern void _PyErr_WarnUnawaitedAgenMethod(PyAsyncGenObject *agen, PyObject *method);
|
extern void _PyErr_WarnUnawaitedAgenMethod(PyAsyncGenObject *agen, PyObject *method);
|
||||||
|
|
Loading…
Reference in New Issue