Skip to content

Commit 4e29f56

Browse files
Add missed details of the C API introduced in 3.7. (GH-7047)
* Set the limited API version for PyImport_GetModule and PyOS_*Fork functions. * Add PyImport_GetModule and Py_UTF8Mode in PC/python3.def. * Add several functions in Doc/data/refcounts.dat.
1 parent b2f5f59 commit 4e29f56

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

Doc/data/refcounts.dat

+76
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,47 @@ PyComplex_ImagAsDouble:PyObject*:op:0:
152152
PyComplex_RealAsDouble:double:::
153153
PyComplex_RealAsDouble:PyObject*:op:0:
154154

155+
PyContext_CheckExact:int:::
156+
PyContext_CheckExact:PyObject*:o:0:
157+
158+
PyContext_ClearFreeList:int:::
159+
160+
PyContext_Copy:PyObject*::+1:
161+
PyContext_Copy:PyObject*:ctx:0:
162+
163+
PyContext_CopyCurrent:PyObject*::+1:
164+
165+
PyContext_Enter:int:::
166+
PyContext_Enter:PyObject*:ctx:+1:
167+
168+
PyContext_Exit:int:::
169+
PyContext_Exit:PyObject*:ctx:-1:
170+
171+
PyContext_New:PyObject*::+1:
172+
173+
PyContextToken_CheckExact:int:::
174+
PyContextToken_CheckExact:PyObject*:o:0:
175+
176+
PyContextVar_CheckExact:int:::
177+
PyContextVar_CheckExact:PyObject*:o:0:
178+
179+
PyContextVar_Get:int:::
180+
PyContextVar_Get:PyObject*:var:0:
181+
PyContextVar_Get:PyObject*:default_value:0:
182+
PyContextVar_Get:PyObject**:value:+1:???
183+
184+
PyContextVar_New:PyObject*::+1:
185+
PyContextVar_New:const char*:name::
186+
PyContextVar_New:PyObject*:def:+1:
187+
188+
PyContextVar_Set:PyObject*::+1:
189+
PyContextVar_Set:PyObject*:var:0:
190+
PyContextVar_Set:PyObject*:value:+1:
191+
192+
PyContextVar_Reset:int:::
193+
PyContextVar_Reset:PyObject*:var:0:
194+
PyContextVar_Reset:PyObject*:token:-1:
195+
155196
PyDate_FromDate:PyObject*::+1:
156197
PyDate_FromDate:int:year::
157198
PyDate_FromDate:int:month::
@@ -541,6 +582,9 @@ PyImport_ExecCodeModuleEx:const char*:pathname::
541582

542583
PyImport_GetMagicNumber:long:::
543584

585+
PyImport_GetModule:PyObject*::+1:
586+
PyImport_GetModule:PyObject*:name:0:
587+
544588
PyImport_GetModuleDict:PyObject*::0:
545589

546590
PyImport_Import:PyObject*::+1:
@@ -605,6 +649,9 @@ PyInterpreterState_Clear:PyInterpreterState*:interp::
605649
PyInterpreterState_Delete:void:::
606650
PyInterpreterState_Delete:PyInterpreterState*:interp::
607651

652+
PyInterpreterState_GetID:int64_t:::
653+
PyInterpreterState_GetID:PyInterpreterState*:interp::
654+
608655
PyInterpreterState_New:PyInterpreterState*:::
609656

610657
PyIter_Check:int:o:0:
@@ -933,6 +980,14 @@ PyNumber_Xor:PyObject*:o2:0:
933980
PyObject_AsFileDescriptor:int:::
934981
PyObject_AsFileDescriptor:PyObject*:o:0:
935982

983+
PyOS_AfterFork:void:::
984+
985+
PyOS_AfterFork_Child:void:::
986+
987+
PyOS_AfterFork_Parent:void:::
988+
989+
PyOS_BeforeFork:void:::
990+
936991
PyOS_FSPath:PyObject*::+1:
937992
PyOS_FSPath:PyObject*:path:0:
938993

@@ -1252,6 +1307,12 @@ PySet_Pop:PyObject*:set:0:
12521307
PySet_Size:int:::
12531308
PySet_Size:PyObject*:anyset:0:
12541309

1310+
PySlice_AdjustIndices:Py_ssize_t:::
1311+
PySlice_AdjustIndices:Py_ssize_t:length::
1312+
PySlice_AdjustIndices:Py_ssize_t*:start::
1313+
PySlice_AdjustIndices:Py_ssize_t*:stop::
1314+
PySlice_AdjustIndices:Py_ssize_t*:step::
1315+
12551316
PySlice_Check:int:::
12561317
PySlice_Check:PyObject*:ob:0:
12571318

@@ -1260,6 +1321,12 @@ PySlice_New:PyObject*:start:0:
12601321
PySlice_New:PyObject*:stop:0:
12611322
PySlice_New:PyObject*:step:0:
12621323

1324+
PySlice_Unpack:int:::
1325+
PySlice_Unpack:PyObject*:slice:0:
1326+
PySlice_Unpack:Py_ssize_t*:start::
1327+
PySlice_Unpack:Py_ssize_t*:stop::
1328+
PySlice_Unpack:Py_ssize_t*:step::
1329+
12631330
PyString_AS_STRING:const char*:::
12641331
PyString_AS_STRING:PyObject*:string:0:
12651332

@@ -1410,6 +1477,15 @@ PyTime_FromTime:int:minute::
14101477
PyTime_FromTime:int:second::
14111478
PyTime_FromTime:int:usecond::
14121479

1480+
PyTraceMalloc_Track:int:::
1481+
PyTraceMalloc_Track:unsigned int:domain::
1482+
PyTraceMalloc_Track:uintptr_t:ptr::
1483+
PyTraceMalloc_Track:size_t:size::
1484+
1485+
PyTraceMalloc_Untrack:int:::
1486+
PyTraceMalloc_Untrack:unsigned int:domain::
1487+
PyTraceMalloc_Untrack:uintptr_t:ptr::
1488+
14131489
PyTuple_Check:int:::
14141490
PyTuple_Check:PyObject*:p:0:
14151491

Include/import.h

+2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
3838
);
3939
#endif
4040
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
41+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
4142
PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name);
43+
#endif
4244
#ifndef Py_LIMITED_API
4345
PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *);
4446
PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name);

Include/intrcheck.h

+2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ extern "C" {
88
PyAPI_FUNC(int) PyOS_InterruptOccurred(void);
99
PyAPI_FUNC(void) PyOS_InitInterrupts(void);
1010
#ifdef HAVE_FORK
11+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
1112
PyAPI_FUNC(void) PyOS_BeforeFork(void);
1213
PyAPI_FUNC(void) PyOS_AfterFork_Parent(void);
1314
PyAPI_FUNC(void) PyOS_AfterFork_Child(void);
1415
#endif
16+
#endif
1517
/* Deprecated, please use PyOS_AfterFork_Child() instead */
1618
PyAPI_FUNC(void) PyOS_AfterFork(void) Py_DEPRECATED(3.7);
1719

PC/python3.def

+2
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ EXPORTS
284284
PyImport_GetImporter=python38.PyImport_GetImporter
285285
PyImport_GetMagicNumber=python38.PyImport_GetMagicNumber
286286
PyImport_GetMagicTag=python38.PyImport_GetMagicTag
287+
PyImport_GetModule=python38.PyImport_GetModule
287288
PyImport_GetModuleDict=python38.PyImport_GetModuleDict
288289
PyImport_Import=python38.PyImport_Import
289290
PyImport_ImportFrozenModule=python38.PyImport_ImportFrozenModule
@@ -757,6 +758,7 @@ EXPORTS
757758
Py_SetPythonHome=python38.Py_SetPythonHome
758759
Py_SetRecursionLimit=python38.Py_SetRecursionLimit
759760
Py_SymtableString=python38.Py_SymtableString
761+
Py_UTF8Mode=python38.Py_UTF8Mode DATA
760762
Py_VaBuildValue=python38.Py_VaBuildValue
761763
_PyArg_ParseTupleAndKeywords_SizeT=python38._PyArg_ParseTupleAndKeywords_SizeT
762764
_PyArg_ParseTuple_SizeT=python38._PyArg_ParseTuple_SizeT

0 commit comments

Comments
 (0)