Skip to content

Commit 3e0daeb

Browse files
committed
[GR-9580] Additions to get gmpy2 to compile and beginning to load
PullRequest: graalpython-open/20
2 parents eeb67f0 + 40fe360 commit 3e0daeb

39 files changed

+1229
-85
lines changed

graalpython/com.oracle.graal.python.cext/include/Python.h

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#include "objimpl.h"
8282
#include "bytesobject.h"
8383
#include "longobject.h"
84+
#include "longintrepr.h"
8485
#include "boolobject.h"
8586
#include "floatobject.h"
8687
#include "dictobject.h"
@@ -93,6 +94,11 @@
9394
#include "pyctype.h"
9495
#include "bytearrayobject.h"
9596
#include "warnings.h"
97+
#include "patchlevel.h"
98+
#include "pymath.h"
99+
#include "pyhash.h"
100+
#include "import.h"
101+
#include "pycapsule.h"
96102

97103
// our impls
98104
#ifdef Py_True
@@ -113,10 +119,14 @@
113119

114120
// TODO: we must extend the refcounting behavior to support handles to managed objects
115121
#undef Py_DECREF
116-
#define Py_DECREF(o)
122+
#define Py_DECREF(o) 0
117123
#undef Py_INCREF
118-
#define Py_INCREF(o)
124+
#define Py_INCREF(o) 0
119125

126+
// TODO: (tfel) Is this necessary?
127+
#ifndef Py_BuildValue
128+
#define Py_BuildValue _Py_BuildValue_SizeT
129+
#endif
120130

121131
/*
122132
* #define Py_INCREF(op) ( \
@@ -146,23 +156,33 @@
146156

147157
#define _PyLong_FromTime_t(o) ((long)o)
148158

149-
extern int PyTruffle_Arg_ParseTupleAndKeywords(PyObject *argv, PyObject *kwds, const char *format, char** kwdnames, int outc, void *v0, void *v1, void *v2, void *v3, void *v4, void *v5, void *v6, void *v7, void *v8, void *v9);
150-
151-
#define PyTruffle_Arg_ParseTupleAndKeywords_1(ARGV, KWDS, FORMAT, KWDNAMES, V1) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 1, (void*)V1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
152-
#define PyTruffle_Arg_ParseTupleAndKeywords_2(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 2, (void*)V1, (void*)V2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
153-
#define PyTruffle_Arg_ParseTupleAndKeywords_3(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 3, (void*)V1, (void*)V2, (void*)V3, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
154-
#define PyTruffle_Arg_ParseTupleAndKeywords_4(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 4, (void*)V1, (void*)V2, (void*)V3, (void*)V4, NULL, NULL, NULL, NULL, NULL, NULL)
155-
#define PyTruffle_Arg_ParseTupleAndKeywords_5(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 5, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, NULL, NULL, NULL, NULL, NULL)
156-
#define PyTruffle_Arg_ParseTupleAndKeywords_6(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 6, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, NULL, NULL, NULL, NULL)
157-
#define PyTruffle_Arg_ParseTupleAndKeywords_7(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 7, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, NULL, NULL, NULL)
158-
#define PyTruffle_Arg_ParseTupleAndKeywords_8(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 8, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, NULL, NULL)
159-
#define PyTruffle_Arg_ParseTupleAndKeywords_9(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 9, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, NULL)
160-
#define PyTruffle_Arg_ParseTupleAndKeywords_10(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 10, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10)
161-
#define ARG_PARSE_TUPLE_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, NAME, ...) NAME
159+
extern int PyTruffle_Arg_ParseTupleAndKeywords(PyObject *argv, PyObject *kwds, const char *format, char** kwdnames, int outc, void *v0, void *v1, void *v2, void *v3, void *v4, void *v5, void *v6, void *v7, void *v8, void *v9, void *v10, void *v11, void *v12, void *v13, void *v14, void *v15, void *v16, void *v17, void *v18, void *v19);
160+
161+
#define PyTruffle_Arg_ParseTupleAndKeywords_1(ARGV, KWDS, FORMAT, KWDNAMES, V1) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 1, (void*)V1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
162+
#define PyTruffle_Arg_ParseTupleAndKeywords_2(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 2, (void*)V1, (void*)V2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
163+
#define PyTruffle_Arg_ParseTupleAndKeywords_3(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 3, (void*)V1, (void*)V2, (void*)V3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
164+
#define PyTruffle_Arg_ParseTupleAndKeywords_4(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 4, (void*)V1, (void*)V2, (void*)V3, (void*)V4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
165+
#define PyTruffle_Arg_ParseTupleAndKeywords_5(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 5, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
166+
#define PyTruffle_Arg_ParseTupleAndKeywords_6(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 6, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
167+
#define PyTruffle_Arg_ParseTupleAndKeywords_7(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 7, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
168+
#define PyTruffle_Arg_ParseTupleAndKeywords_8(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 8, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
169+
#define PyTruffle_Arg_ParseTupleAndKeywords_9(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 9, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
170+
#define PyTruffle_Arg_ParseTupleAndKeywords_10(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 10, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
171+
#define PyTruffle_Arg_ParseTupleAndKeywords_11(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 11, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
172+
#define PyTruffle_Arg_ParseTupleAndKeywords_12(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 12, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
173+
#define PyTruffle_Arg_ParseTupleAndKeywords_13(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 13, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
174+
#define PyTruffle_Arg_ParseTupleAndKeywords_14(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 14, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, (void*)V14, NULL, NULL, NULL, NULL, NULL, NULL)
175+
#define PyTruffle_Arg_ParseTupleAndKeywords_15(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 15, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, (void*)V14, (void*)V15, NULL, NULL, NULL, NULL, NULL)
176+
#define PyTruffle_Arg_ParseTupleAndKeywords_16(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 16, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, (void*)V14, (void*)V15, (void*)V16, NULL, NULL, NULL, NULL)
177+
#define PyTruffle_Arg_ParseTupleAndKeywords_17(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 17, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, (void*)V14, (void*)V15, (void*)V16, (void*)V17, NULL, NULL, NULL)
178+
#define PyTruffle_Arg_ParseTupleAndKeywords_18(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 18, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, (void*)V14, (void*)V15, (void*)V16, (void*)V17, (void*)V18, NULL, NULL)
179+
#define PyTruffle_Arg_ParseTupleAndKeywords_19(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 19, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, (void*)V14, (void*)V15, (void*)V16, (void*)V17, (void*)V18, (void*)V19, NULL)
180+
#define PyTruffle_Arg_ParseTupleAndKeywords_20(ARGV, KWDS, FORMAT, KWDNAMES, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19, V20) PyTruffle_Arg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, 20, (void*)V1, (void*)V2, (void*)V3, (void*)V4, (void*)V5, (void*)V6, (void*)V7, (void*)V8, (void*)V9, (void*)V10, (void*)V11, (void*)V12, (void*)V13, (void*)V14, (void*)V15, (void*)V16, (void*)V17, (void*)V18, (void*)V19, (void*)V20)
181+
#define ARG_PARSE_TUPLE_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, NAME, ...) NAME
162182
#ifdef PyArg_ParseTupleAndKeywords
163183
#undef PyArg_ParseTupleAndKeywords
164184
#endif
165-
#define PyArg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, ...) ARG_PARSE_TUPLE_IMPL(__VA_ARGS__, PyTruffle_Arg_ParseTupleAndKeywords_10, PyTruffle_Arg_ParseTupleAndKeywords_9, PyTruffle_Arg_ParseTupleAndKeywords_8, PyTruffle_Arg_ParseTupleAndKeywords_7, PyTruffle_Arg_ParseTupleAndKeywords_6, PyTruffle_Arg_ParseTupleAndKeywords_5, PyTruffle_Arg_ParseTupleAndKeywords_4, PyTruffle_Arg_ParseTupleAndKeywords_3, PyTruffle_Arg_ParseTupleAndKeywords_2, PyTruffle_Arg_ParseTupleAndKeywords_1)(ARGV, KWDS, FORMAT, KWDNAMES, __VA_ARGS__)
185+
#define PyArg_ParseTupleAndKeywords(ARGV, KWDS, FORMAT, KWDNAMES, ...) ARG_PARSE_TUPLE_IMPL(__VA_ARGS__, PyTruffle_Arg_ParseTupleAndKeywords_20, PyTruffle_Arg_ParseTupleAndKeywords_19, PyTruffle_Arg_ParseTupleAndKeywords_18, PyTruffle_Arg_ParseTupleAndKeywords_17, PyTruffle_Arg_ParseTupleAndKeywords_16, PyTruffle_Arg_ParseTupleAndKeywords_15, PyTruffle_Arg_ParseTupleAndKeywords_14, PyTruffle_Arg_ParseTupleAndKeywords_13, PyTruffle_Arg_ParseTupleAndKeywords_12, PyTruffle_Arg_ParseTupleAndKeywords_11, PyTruffle_Arg_ParseTupleAndKeywords_10, PyTruffle_Arg_ParseTupleAndKeywords_9, PyTruffle_Arg_ParseTupleAndKeywords_8, PyTruffle_Arg_ParseTupleAndKeywords_7, PyTruffle_Arg_ParseTupleAndKeywords_6, PyTruffle_Arg_ParseTupleAndKeywords_5, PyTruffle_Arg_ParseTupleAndKeywords_4, PyTruffle_Arg_ParseTupleAndKeywords_3, PyTruffle_Arg_ParseTupleAndKeywords_2, PyTruffle_Arg_ParseTupleAndKeywords_1)(ARGV, KWDS, FORMAT, KWDNAMES, __VA_ARGS__)
166186

167187
#ifdef PyArg_ParseTuple
168188
#undef PyArg_ParseTuple
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
/* Copyright (c) 2018, Oracle and/or its affiliates.
2+
* Copyright (C) 1996-2017 Python Software Foundation
3+
*
4+
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
5+
*/
6+
7+
/* Module definition and import interface */
8+
9+
#ifndef Py_IMPORT_H
10+
#define Py_IMPORT_H
11+
#ifdef __cplusplus
12+
extern "C" {
13+
#endif
14+
15+
#ifndef Py_LIMITED_API
16+
/* (tfel): commented out, because we don't want to provide the _PyInitError
17+
* struct right now
18+
*
19+
* PyAPI_FUNC(_PyInitError) _PyImportZip_Init(void);
20+
*/
21+
22+
PyMODINIT_FUNC PyInit_imp(void);
23+
#endif /* !Py_LIMITED_API */
24+
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
25+
PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
26+
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
27+
const char *name, /* UTF-8 encoded string */
28+
PyObject *co
29+
);
30+
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
31+
const char *name, /* UTF-8 encoded string */
32+
PyObject *co,
33+
const char *pathname /* decoded from the filesystem encoding */
34+
);
35+
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
36+
const char *name, /* UTF-8 encoded string */
37+
PyObject *co,
38+
const char *pathname, /* decoded from the filesystem encoding */
39+
const char *cpathname /* decoded from the filesystem encoding */
40+
);
41+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
42+
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
43+
PyObject *name,
44+
PyObject *co,
45+
PyObject *pathname,
46+
PyObject *cpathname
47+
);
48+
#endif
49+
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
50+
PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name);
51+
#ifndef Py_LIMITED_API
52+
PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *);
53+
PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name);
54+
PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *name,
55+
PyObject *modules);
56+
PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module);
57+
PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module);
58+
#endif
59+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
60+
PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
61+
PyObject *name
62+
);
63+
#endif
64+
#ifndef Py_LIMITED_API
65+
PyAPI_FUNC(PyObject *) _PyImport_AddModuleObject(PyObject *, PyObject *);
66+
#endif
67+
PyAPI_FUNC(PyObject *) PyImport_AddModule(
68+
const char *name /* UTF-8 encoded string */
69+
);
70+
PyAPI_FUNC(PyObject *) PyImport_ImportModule(
71+
const char *name /* UTF-8 encoded string */
72+
);
73+
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
74+
const char *name /* UTF-8 encoded string */
75+
);
76+
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
77+
const char *name, /* UTF-8 encoded string */
78+
PyObject *globals,
79+
PyObject *locals,
80+
PyObject *fromlist,
81+
int level
82+
);
83+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
84+
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
85+
PyObject *name,
86+
PyObject *globals,
87+
PyObject *locals,
88+
PyObject *fromlist,
89+
int level
90+
);
91+
#endif
92+
93+
#define PyImport_ImportModuleEx(n, g, l, f) \
94+
PyImport_ImportModuleLevel(n, g, l, f, 0)
95+
96+
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
97+
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
98+
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
99+
PyAPI_FUNC(void) PyImport_Cleanup(void);
100+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
101+
PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
102+
PyObject *name
103+
);
104+
#endif
105+
PyAPI_FUNC(int) PyImport_ImportFrozenModule(
106+
const char *name /* UTF-8 encoded string */
107+
);
108+
109+
#ifndef Py_LIMITED_API
110+
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
111+
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
112+
113+
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
114+
115+
PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
116+
const char *name, /* UTF-8 encoded string */
117+
PyObject *modules
118+
);
119+
PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
120+
PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObjectEx(PyObject *, PyObject *,
121+
PyObject *);
122+
PyAPI_FUNC(int) _PyImport_FixupBuiltin(
123+
PyObject *mod,
124+
const char *name, /* UTF-8 encoded string */
125+
PyObject *modules
126+
);
127+
PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *,
128+
PyObject *, PyObject *);
129+
130+
struct _inittab {
131+
const char *name; /* ASCII encoded string */
132+
PyObject* (*initfunc)(void);
133+
};
134+
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
135+
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
136+
#endif /* Py_LIMITED_API */
137+
138+
PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
139+
140+
PyAPI_FUNC(int) PyImport_AppendInittab(
141+
const char *name, /* ASCII encoded string */
142+
PyObject* (*initfunc)(void)
143+
);
144+
145+
#ifndef Py_LIMITED_API
146+
struct _frozen {
147+
const char *name; /* ASCII encoded string */
148+
const unsigned char *code;
149+
int size;
150+
};
151+
152+
/* Embedding apps may change this pointer to point to their favorite
153+
collection of frozen modules: */
154+
155+
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
156+
#endif
157+
158+
#ifdef __cplusplus
159+
}
160+
#endif
161+
#endif /* !Py_IMPORT_H */

0 commit comments

Comments
 (0)