No longer export _PyCompile_AstOptimize() internal C API function.
Change comment style to "// comment" and add comment explaining why
other functions have to be exported.
extern PyObject* _PyBytes_Join(PyObject *sep, PyObject *x);
-/* Substring Search.
-
- Returns the index of the first occurrence of
- a substring ("needle") in a larger text ("haystack").
- If the needle is not found, return -1.
- If the needle is found, add offset to the index.
-*/
-
+// Substring Search.
+//
+// Returns the index of the first occurrence of
+// a substring ("needle") in a larger text ("haystack").
+// If the needle is not found, return -1.
+// If the needle is found, add offset to the index.
+//
+// Export for 'mmap' shared extension.
PyAPI_FUNC(Py_ssize_t)
_PyBytes_Find(const char *haystack, Py_ssize_t len_haystack,
const char *needle, Py_ssize_t len_needle,
Py_ssize_t offset);
-/* Same as above, but search right-to-left */
+// Same as above, but search right-to-left.
+// Export for 'mmap' shared extension.
PyAPI_FUNC(Py_ssize_t)
_PyBytes_ReverseFind(const char *haystack, Py_ssize_t len_haystack,
const char *needle, Py_ssize_t len_needle,
Py_ssize_t offset);
-/** Helper function to implement the repeat and inplace repeat methods on a buffer
- *
- * len_dest is assumed to be an integer multiple of len_src.
- * If src equals dest, then assume the operation is inplace.
- *
- * This method repeately doubles the number of bytes copied to reduce
- * the number of invocations of memcpy.
- */
+// Helper function to implement the repeat and inplace repeat methods on a
+// buffer.
+//
+// len_dest is assumed to be an integer multiple of len_src.
+// If src equals dest, then assume the operation is inplace.
+//
+// This method repeately doubles the number of bytes copied to reduce
+// the number of invocations of memcpy.
+//
+// Export for 'array' shared extension.
PyAPI_FUNC(void)
_PyBytes_Repeat(char* dest, Py_ssize_t len_dest,
const char* src, Py_ssize_t len_src);
/* Initialize a bytes writer
By default, the overallocation is disabled. Set the overallocate attribute
- to control the allocation of the buffer. */
+ to control the allocation of the buffer.
+
+ Export _PyBytesWriter API for '_pickle' shared extension. */
PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter *writer);
/* Get the buffer content and reset the writer.
#define _PY_FASTCALL_SMALL_STACK 5
-// Export for 'math' shared extension, function used
-// via inlined _PyObject_VectorcallTstate() function.
+// Export for 'math' shared extension, used via _PyObject_VectorcallTstate()
+// static inline function.
PyAPI_FUNC(PyObject*) _Py_CheckFunctionResult(
PyThreadState *tstate,
PyObject *callable,
// Call callable using tp_call. Arguments are like PyObject_Vectorcall(),
// except that nargs is plainly the number of arguments without flags.
//
-// Export for 'math' shared extension, function used
-// via inlined _PyObject_VectorcallTstate() function.
+// Export for 'math' shared extension, used via _PyObject_VectorcallTstate()
+// static inline function.
PyAPI_FUNC(PyObject*) _PyObject_MakeTpCall(
PyThreadState *tstate,
PyObject *callable,
extern void _PyEval_InitState(PyInterpreterState *, PyThread_type_lock);
extern void _PyEval_FiniState(struct _ceval_state *ceval);
extern void _PyEval_SignalReceived(PyInterpreterState *interp);
+
// Export for '_testinternalcapi' shared extension
PyAPI_FUNC(int) _PyEval_AddPendingCall(
PyInterpreterState *interp,
int (*func)(void *),
void *arg,
int mainthreadonly);
+
extern void _PyEval_SignalAsyncExc(PyInterpreterState *interp);
#ifdef HAVE_FORK
extern PyStatus _PyEval_ReInitThreads(PyThreadState *tstate);
}
#endif
-// Export for _Py_EnterRecursiveCall()
+// Export for '_json' shared extension, used via _Py_EnterRecursiveCall()
+// static inline function.
PyAPI_FUNC(int) _Py_CheckRecursiveCall(
PyThreadState *tstate,
const char *where);
struct _arena *arena);
/* AST optimizations */
-PyAPI_FUNC(int) _PyCompile_AstOptimize(
+extern int _PyCompile_AstOptimize(
struct _mod *mod,
PyObject *filename,
PyCompilerFlags *flags,
// Export for '_testinternalcapi' shared extension
PyAPI_FUNC(PyObject*) _PyCompile_CleanDoc(PyObject *doc);
+// Export for '_testinternalcapi' shared extension
PyAPI_FUNC(PyObject*) _PyCompile_CodeGen(
PyObject *ast,
PyObject *filename,
int optimize,
int compile_mode);
+// Export for '_testinternalcapi' shared extension
PyAPI_FUNC(PyObject*) _PyCompile_OptimizeCfg(
PyObject *instructions,
PyObject *consts,
int nlocals);
+// Export for '_testinternalcapi' shared extension
PyAPI_FUNC(PyCodeObject*)
_PyCompile_Assemble(_PyCompile_CodeUnitMetadata *umd, PyObject *filename,
PyObject *instructions);
#include "pycore_unicodeobject.h" // _PyUnicodeWriter
-/* Operations on complex numbers from complexmodule.c */
-
+// Operations on complex numbers.
+// Export functions for 'cmath' shared extension.
PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex);
PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex);
PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex);
_Py_ERROR_OTHER
} _Py_error_handler;
+// Export for '_testinternalcapi' shared extension
PyAPI_FUNC(_Py_error_handler) _Py_GetErrorHandler(const char *errors);
+// Export for '_testinternalcapi' shared extension
PyAPI_FUNC(int) _Py_DecodeLocaleEx(
const char *arg,
wchar_t **wstr,
int current_locale,
_Py_error_handler errors);
+// Export for '_testinternalcapi' shared extension
PyAPI_FUNC(int) _Py_EncodeLocaleEx(
const wchar_t *text,
char **str,
# define _Py_stat_struct stat
#endif
+// Export for 'mmap' shared extension
PyAPI_FUNC(int) _Py_fstat(
int fd,
struct _Py_stat_struct *status);
+// Export for 'mmap' shared extension
PyAPI_FUNC(int) _Py_fstat_noraise(
int fd,
struct _Py_stat_struct *status);
+// Export for '_tkinter' shared extension
PyAPI_FUNC(int) _Py_stat(
PyObject *path,
struct stat *status);
-// Export for 'select' shared extension (Solaris newDevPollObject() uses it)
+// Export for 'select' shared extension (Solaris newDevPollObject())
PyAPI_FUNC(int) _Py_open(
const char *pathname,
int flags);
+// Export for '_posixsubprocess' shared extension
PyAPI_FUNC(int) _Py_open_noraise(
const char *pathname,
int flags);
void *buf,
size_t count);
-// Export for 'select' shared extension (Solaris devpoll_flush() uses it)
+// Export for 'select' shared extension (Solaris devpoll_flush())
PyAPI_FUNC(Py_ssize_t) _Py_write(
int fd,
const void *buf,
size_t count);
+// Export for '_posixsubprocess' shared extension
PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
int fd,
const void *buf,
extern int _Py_get_inheritable(int fd);
+// Export for '_socket' shared extension
PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
int *atomic_flag_works);
+// Export for '_posixsubprocess' shared extension
PyAPI_FUNC(int) _Py_set_inheritable_async_safe(int fd, int inheritable,
int *atomic_flag_works);
+// Export for '_socket' shared extension
PyAPI_FUNC(int) _Py_dup(int fd);
extern int _Py_get_blocking(int fd);
#ifdef MS_WINDOWS
extern void* _Py_get_osfhandle_noraise(int fd);
+// Export for '_testconsole' shared extension
PyAPI_FUNC(void*) _Py_get_osfhandle(int fd);
extern int _Py_open_osfhandle_noraise(void *handle, int flags);
PyObject **decimal_point,
PyObject **thousands_sep);
+// Export for '_posixsubprocess' (on macOS)
PyAPI_FUNC(void) _Py_closerange(int first, int last);
extern wchar_t* _Py_GetLocaleEncoding(void);
const wchar_t *relfile,
size_t bufsize);
extern size_t _Py_find_basename(const wchar_t *filename);
+
+// Export for '_testinternalcapi' shared extension
PyAPI_FUNC(wchar_t*) _Py_normpath(wchar_t *path, Py_ssize_t size);
+
extern wchar_t *_Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *length);
// The Windows Games API family does not provide these functions
// Export for '_asyncio' shared extension
PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
+
// Export for '_asyncio' shared extension
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
_Py_hashtable_allocator_t alloc;
};
+// Export _Py_hashtable functions for '_testinternalcapi' shared extension
+PyAPI_FUNC(_Py_hashtable_t *) _Py_hashtable_new(
+ _Py_hashtable_hash_func hash_func,
+ _Py_hashtable_compare_func compare_func);
+
/* Hash a pointer (void*) */
PyAPI_FUNC(Py_uhash_t) _Py_hashtable_hash_ptr(const void *key);
const void *key1,
const void *key2);
-PyAPI_FUNC(_Py_hashtable_t *) _Py_hashtable_new(
- _Py_hashtable_hash_func hash_func,
- _Py_hashtable_compare_func compare_func);
-
PyAPI_FUNC(_Py_hashtable_t *) _Py_hashtable_new_full(
_Py_hashtable_hash_func hash_func,
_Py_hashtable_compare_func compare_func,
extern int _PyImport_IsInitialized(PyInterpreterState *);
+// Export for 'pyexpat' shared extension
PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module);
+
extern int _PyImport_SetModuleString(const char *name, PyObject* module);
extern void _PyImport_AcquireLock(PyInterpreterState *interp);
extern int _PyImport_FixupExtensionObject(PyObject*, PyObject *,
PyObject *, PyObject *);
+// Export for many shared extensions, like '_json'
PyAPI_FUNC(PyObject*) _PyImport_GetModuleAttr(PyObject *, PyObject *);
+
+// Export for many shared extensions, like '_datetime'
PyAPI_FUNC(PyObject*) _PyImport_GetModuleAttrString(const char *, const char *);
const char *orig; /* ASCII encoded string */
};
-// Export for test_ctypes
+// Export these 3 symbols for test_ctypes
PyAPI_DATA(const struct _frozen*) _PyImport_FrozenBootstrap;
-// Export for test_ctypes
PyAPI_DATA(const struct _frozen*) _PyImport_FrozenStdlib;
-// Export for test_ctypes
PyAPI_DATA(const struct _frozen*) _PyImport_FrozenTest;
extern const struct _module_alias * _PyImport_FrozenAliases;
// Export for '_testembed' program
PyAPI_FUNC(void) _PyPreConfig_InitCompatConfig(PyPreConfig *preconfig);
+
extern void _PyPreConfig_InitFromConfig(
PyPreConfig *preconfig,
const PyConfig *config);
// Export for '_testembed' program
PyAPI_FUNC(void) _PyConfig_InitCompatConfig(PyConfig *config);
+
extern PyStatus _PyConfig_Copy(
PyConfig *config,
const PyConfig *config2);
PyConfig *config,
const _PyArgv *args);
-PyAPI_FUNC(PyObject*) _PyConfig_AsDict(const PyConfig *config);
-PyAPI_FUNC(int) _PyConfig_FromDict(PyConfig *config, PyObject *dict);
extern void _Py_DumpPathConfig(PyThreadState *tstate);
-PyAPI_FUNC(PyObject*) _Py_Get_Getpath_CodeObject(void);
-
/* --- Function used for testing ---------------------------------- */
+// Export these functions for '_testinternalcapi' shared extension
+PyAPI_FUNC(PyObject*) _PyConfig_AsDict(const PyConfig *config);
+PyAPI_FUNC(int) _PyConfig_FromDict(PyConfig *config, PyObject *dict);
+PyAPI_FUNC(PyObject*) _Py_Get_Getpath_CodeObject(void);
PyAPI_FUNC(PyObject*) _Py_GetConfigsAsDict(void);
#ifdef __cplusplus