#define _PY_FASTCALL_SMALL_STACK 5
-// Export for shared stdlib extensions like the math extension,
-// function used via inlined _PyObject_VectorcallTstate() function.
+// Export for 'math' shared extension, function used
+// via inlined _PyObject_VectorcallTstate() function.
PyAPI_FUNC(PyObject*) _Py_CheckFunctionResult(
PyThreadState *tstate,
PyObject *callable,
const char *format,
...);
-// Export for shared stdlib extensions like the array extension
+// Export for 'array' shared extension
PyAPI_FUNC(PyObject*) _PyObject_CallMethod(
PyObject *obj,
PyObject *name,
// Call callable using tp_call. Arguments are like PyObject_Vectorcall(),
// except that nargs is plainly the number of arguments without flags.
//
-// Export for shared stdlib extensions like the math extension,
-// function used via inlined _PyObject_VectorcallTstate() function.
+// Export for 'math' shared extension, function used
+// via inlined _PyObject_VectorcallTstate() function.
PyAPI_FUNC(PyObject*) _PyObject_MakeTpCall(
PyThreadState *tstate,
PyObject *callable,
// back to a regular function signature. Regardless, this approach
// wouldn't be appropriate if this weren't a strictly internal API.
// (See the comments in https://github.com/python/cpython/pull/26258.)
-PyAPI_FUNC(int) _PyCode_Validate(struct _PyCodeConstructor *);
-PyAPI_FUNC(PyCodeObject *) _PyCode_New(struct _PyCodeConstructor *);
+extern int _PyCode_Validate(struct _PyCodeConstructor *);
+extern PyCodeObject* _PyCode_New(struct _PyCodeConstructor *);
/* Private API */
#define EVAL_CALL_STAT_INC_IF_FUNCTION(name, callable) \
do { if (_py_stats && PyFunction_Check(callable)) _py_stats->call_stats.eval_calls[name]++; } while (0)
-// Used by the _opcode extension which is built as a shared library
+// Export for stdlib '_opcode' shared extension
PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);
#else
struct _arena; // Type defined in pycore_pyarena.h
struct _mod; // Type defined in pycore_ast.h
-// Export the symbol for test_peg_generator (built as a library)
+// Export for 'test_peg_generator' shared extension
PyAPI_FUNC(PyCodeObject*) _PyAST_Compile(
struct _mod *mod,
PyObject *filename,
/* Access compiler internals for unit testing */
+// Export for '_testinternalcapi' shared extension
PyAPI_FUNC(PyObject*) _PyCompile_CleanDoc(PyObject *doc);
PyAPI_FUNC(PyObject*) _PyCompile_CodeGen(
/* These functions are used by modules compiled as C extension like math:
they must be exported. */
-PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr);
-PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits,
- int *decpt, int *sign, char **rve);
-PyAPI_FUNC(void) _Py_dg_freedtoa(char *s);
+extern double _Py_dg_strtod(const char *str, char **ptr);
+extern char* _Py_dg_dtoa(double d, int mode, int ndigits,
+ int *decpt, int *sign, char **rve);
+extern void _Py_dg_freedtoa(char *s);
#endif // _PY_SHORT_FLOAT_REPR == 1
int current_locale,
_Py_error_handler errors);
-PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
+extern char* _Py_EncodeLocaleRaw(
const wchar_t *text,
size_t *error_pos);
-PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
+extern PyObject* _Py_device_encoding(int);
#if defined(MS_WINDOWS) || defined(__APPLE__)
/* On Windows, the count parameter of read() is an int (bpo-9015, bpo-9611).
PyObject *path,
struct stat *status);
-PyAPI_FUNC(int) _Py_open(
+extern int _Py_open(
const char *pathname,
int flags);
const char *pathname,
int flags);
-PyAPI_FUNC(FILE *) _Py_wfopen(
+extern FILE* _Py_wfopen(
const wchar_t *path,
const wchar_t *mode);
-PyAPI_FUNC(Py_ssize_t) _Py_read(
+extern Py_ssize_t _Py_read(
int fd,
void *buf,
size_t count);
-PyAPI_FUNC(Py_ssize_t) _Py_write(
+extern Py_ssize_t _Py_write(
int fd,
const void *buf,
size_t count);
size_t count);
#ifdef HAVE_READLINK
-PyAPI_FUNC(int) _Py_wreadlink(
+extern int _Py_wreadlink(
const wchar_t *path,
wchar_t *buf,
/* Number of characters of 'buf' buffer
#endif
#ifdef HAVE_REALPATH
-PyAPI_FUNC(wchar_t*) _Py_wrealpath(
+extern wchar_t* _Py_wrealpath(
const wchar_t *path,
wchar_t *resolved_path,
/* Number of characters of 'resolved_path' buffer
size_t resolved_path_len);
#endif
-PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
+extern wchar_t* _Py_wgetcwd(
wchar_t *buf,
/* Number of characters of 'buf' buffer
including the trailing NUL character */
size_t buflen);
-PyAPI_FUNC(int) _Py_get_inheritable(int fd);
+extern int _Py_get_inheritable(int fd);
PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
int *atomic_flag_works);
PyAPI_FUNC(int) _Py_dup(int fd);
-PyAPI_FUNC(int) _Py_get_blocking(int fd);
+extern int _Py_get_blocking(int fd);
-PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
+extern int _Py_set_blocking(int fd, int blocking);
#ifdef MS_WINDOWS
-PyAPI_FUNC(void*) _Py_get_osfhandle_noraise(int fd);
+extern void* _Py_get_osfhandle_noraise(int fd);
PyAPI_FUNC(void*) _Py_get_osfhandle(int fd);
-PyAPI_FUNC(int) _Py_open_osfhandle_noraise(void *handle, int flags);
+extern int _Py_open_osfhandle_noraise(void *handle, int flags);
-PyAPI_FUNC(int) _Py_open_osfhandle(void *handle, int flags);
+extern int _Py_open_osfhandle(void *handle, int flags);
#endif /* MS_WINDOWS */
// This is used after getting NULL back from Py_DecodeLocale().
? _PyStatus_ERR("cannot decode " NAME) \
: _PyStatus_NO_MEMORY()
-PyAPI_DATA(int) _Py_HasFileSystemDefaultEncodeErrors;
+extern int _Py_HasFileSystemDefaultEncodeErrors;
-PyAPI_FUNC(int) _Py_DecodeUTF8Ex(
+extern int _Py_DecodeUTF8Ex(
const char *arg,
Py_ssize_t arglen,
wchar_t **wstr,
const char **reason,
_Py_error_handler errors);
-PyAPI_FUNC(int) _Py_EncodeUTF8Ex(
+extern int _Py_EncodeUTF8Ex(
const wchar_t *text,
char **str,
size_t *error_pos,
int raw_malloc,
_Py_error_handler errors);
-PyAPI_FUNC(wchar_t*) _Py_DecodeUTF8_surrogateescape(
+extern wchar_t* _Py_DecodeUTF8_surrogateescape(
const char *arg,
Py_ssize_t arglen,
size_t *wlen);
extern int
_Py_wstat(const wchar_t *, struct stat *);
-PyAPI_FUNC(int) _Py_GetForceASCII(void);
+extern int _Py_GetForceASCII(void);
/* Reset "force ASCII" mode (if it was initialized).
This function should be called when Python changes the LC_CTYPE locale,
so the "force ASCII" mode can be detected again on the new locale
encoding. */
-PyAPI_FUNC(void) _Py_ResetForceASCII(void);
+extern void _Py_ResetForceASCII(void);
-PyAPI_FUNC(int) _Py_GetLocaleconvNumeric(
+extern int _Py_GetLocaleconvNumeric(
struct lconv *lc,
PyObject **decimal_point,
PyObject **thousands_sep);
PyAPI_FUNC(void) _Py_closerange(int first, int last);
-PyAPI_FUNC(wchar_t*) _Py_GetLocaleEncoding(void);
-PyAPI_FUNC(PyObject*) _Py_GetLocaleEncodingObject(void);
+extern wchar_t* _Py_GetLocaleEncoding(void);
+extern PyObject* _Py_GetLocaleEncodingObject(void);
#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
extern int _Py_LocaleUsesNonUnicodeWchar(void);
#ifdef MS_WINDOWS
extern int _PyOS_getfullpathname(const wchar_t *path, wchar_t **abspath_p);
#endif
-extern wchar_t * _Py_join_relfile(const wchar_t *dirname,
- const wchar_t *relfile);
+extern wchar_t* _Py_join_relfile(const wchar_t *dirname,
+ const wchar_t *relfile);
extern int _Py_add_relfile(wchar_t *dirname,
const wchar_t *relfile,
size_t bufsize);
extern size_t _Py_find_basename(const wchar_t *filename);
-PyAPI_FUNC(wchar_t *) _Py_normpath(wchar_t *path, Py_ssize_t size);
+PyAPI_FUNC(wchar_t*) _Py_normpath(wchar_t *path, Py_ssize_t size);
// The Windows Games API family does not provide these functions
// so provide our own implementations. Remove them in case they get added
void _PyFloat_ExactDealloc(PyObject *op);
-PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out);
+extern void _PyFloat_DebugMallocStats(FILE* out);
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
-PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter(
+extern int _PyFloat_FormatAdvancedWriter(
_PyUnicodeWriter *writer,
PyObject *obj,
PyObject *format_spec,
extern PyObject *_PyGen_yf(PyGenObject *);
extern void _PyGen_Finalize(PyObject *self);
-// _asyncio shared extensions uses _PyGen_SetStopIterationValue() and
-// _PyGen_FetchStopIterationValue()
+// Export for '_asyncio' shared extension
PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
+// Export for '_asyncio' shared extension
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
extern PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
extern int _PyImport_IsInitialized(PyInterpreterState *);
-PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(_Py_Identifier *name);
+extern PyObject* _PyImport_GetModuleId(_Py_Identifier *name);
PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module);
-PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module);
+extern int _PyImport_SetModuleString(const char *name, PyObject* module);
extern void _PyImport_AcquireLock(PyInterpreterState *interp);
extern int _PyImport_ReleaseLock(PyInterpreterState *interp);
extern int _PyImport_FixupExtensionObject(PyObject*, PyObject *,
PyObject *, PyObject *);
-PyAPI_FUNC(PyObject *) _PyImport_GetModuleAttr(PyObject *, PyObject *);
-PyAPI_FUNC(PyObject *) _PyImport_GetModuleAttrString(const char *, const char *);
+PyAPI_FUNC(PyObject*) _PyImport_GetModuleAttr(PyObject *, PyObject *);
+PyAPI_FUNC(PyObject*) _PyImport_GetModuleAttrString(const char *, const char *);
struct _import_runtime_state {
PyAPI_DATA(const struct _frozen *) _PyImport_FrozenTest;
extern const struct _module_alias * _PyImport_FrozenAliases;
-PyAPI_FUNC(int) _PyImport_CheckSubinterpIncompatibleExtensionAllowed(
+extern int _PyImport_CheckSubinterpIncompatibleExtensionAllowed(
const char *name);
-// for testing
-PyAPI_FUNC(int) _PyImport_ClearExtension(PyObject *name, PyObject *filename);
+// Export for '_testinternalcapi' shared extension
+PyAPI_DATA(int) _PyImport_ClearExtension(PyObject *name, PyObject *filename);
#ifdef __cplusplus
}
#define _PyWideStringList_INIT (PyWideStringList){.length = 0, .items = NULL}
#ifndef NDEBUG
-PyAPI_FUNC(int) _PyWideStringList_CheckConsistency(const PyWideStringList *list);
+extern int _PyWideStringList_CheckConsistency(const PyWideStringList *list);
#endif
-PyAPI_FUNC(void) _PyWideStringList_Clear(PyWideStringList *list);
-PyAPI_FUNC(int) _PyWideStringList_Copy(PyWideStringList *list,
+extern void _PyWideStringList_Clear(PyWideStringList *list);
+extern int _PyWideStringList_Copy(PyWideStringList *list,
const PyWideStringList *list2);
-PyAPI_FUNC(PyStatus) _PyWideStringList_Extend(PyWideStringList *list,
+extern PyStatus _PyWideStringList_Extend(PyWideStringList *list,
const PyWideStringList *list2);
-PyAPI_FUNC(PyObject*) _PyWideStringList_AsList(const PyWideStringList *list);
+extern PyObject* _PyWideStringList_AsList(const PyWideStringList *list);
/* --- _PyArgv ---------------------------------------------------- */
wchar_t * const *wchar_argv;
} _PyArgv;
-PyAPI_FUNC(PyStatus) _PyArgv_AsWstrList(const _PyArgv *args,
+extern PyStatus _PyArgv_AsWstrList(const _PyArgv *args,
PyWideStringList *list);
/* --- Helper functions ------------------------------------------- */
-PyAPI_FUNC(int) _Py_str_to_int(
+extern int _Py_str_to_int(
const char *str,
int *result);
-PyAPI_FUNC(const wchar_t*) _Py_get_xoption(
+extern const wchar_t* _Py_get_xoption(
const PyWideStringList *xoptions,
const wchar_t *name);
-PyAPI_FUNC(const char*) _Py_GetEnv(
+extern const char* _Py_GetEnv(
int use_environment,
const char *name);
-PyAPI_FUNC(void) _Py_get_env_flag(
+extern void _Py_get_env_flag(
int use_environment,
int *flag,
const char *name);
/* Py_GetArgcArgv() helper */
-PyAPI_FUNC(void) _Py_ClearArgcArgv(void);
+extern void _Py_ClearArgcArgv(void);
/* --- _PyPreCmdline ------------------------------------------------- */
crossinterpdatafunc getdata;
};
-PyAPI_FUNC(PyInterpreterState*) _PyInterpreterState_LookUpID(int64_t);
+extern PyInterpreterState* _PyInterpreterState_LookUpID(int64_t);
-PyAPI_FUNC(int) _PyInterpreterState_IDInitref(PyInterpreterState *);
-PyAPI_FUNC(int) _PyInterpreterState_IDIncref(PyInterpreterState *);
-PyAPI_FUNC(void) _PyInterpreterState_IDDecref(PyInterpreterState *);
+extern int _PyInterpreterState_IDInitref(PyInterpreterState *);
+extern int _PyInterpreterState_IDIncref(PyInterpreterState *);
+extern void _PyInterpreterState_IDDecref(PyInterpreterState *);
PyAPI_FUNC(PyObject*) _PyInterpreterState_GetMainModule(PyInterpreterState *);