Skip to content

Commit 02d0a87

Browse files
committed
Update Python inlined files: 3.10
1 parent 1413657 commit 02d0a87

File tree

1,082 files changed

+70268
-32421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,082 files changed

+70268
-32421
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Expat configuration for python. This file is not part of the expat
3+
* distribution.
4+
*/
5+
#ifndef EXPAT_CONFIG_H
6+
#define EXPAT_CONFIG_H
7+
8+
#include <pyconfig.h>
9+
#ifdef WORDS_BIGENDIAN
10+
#define BYTEORDER 4321
11+
#else
12+
#define BYTEORDER 1234
13+
#endif
14+
15+
#define HAVE_MEMMOVE 1
16+
17+
#define XML_NS 1
18+
#define XML_DTD 1
19+
#define XML_CONTEXT_BYTES 1024
20+
21+
#endif /* EXPAT_CONFIG_H */
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
/* Copyright (c) 2005-2006 ActiveState Software Inc.
2+
*
3+
* Namespace all expat exported symbols to avoid dynamic loading symbol
4+
* collisions when embedding Python.
5+
*
6+
* The Problem:
7+
* - you embed Python in some app
8+
* - the app dynamically loads libexpat of version X
9+
* - the embedded Python imports pyexpat (which was built against
10+
* libexpat version X+n)
11+
* --> pyexpat gets the expat symbols from the already loaded and *older*
12+
* libexpat: crash (Specifically the crash we observed was in
13+
* getting an old XML_ErrorString (from xmlparse.c) and then calling
14+
* it with newer values in the XML_Error enum:
15+
*
16+
* // pyexpat.c, line 1970
17+
* ...
18+
* // Added in Expat 1.95.7.
19+
* MYCONST(XML_ERROR_UNBOUND_PREFIX);
20+
* ...
21+
*
22+
*
23+
* The Solution:
24+
* Prefix all exported symbols with "PyExpat_". This is similar to
25+
* what Mozilla does for some common libs:
26+
* http://lxr.mozilla.org/seamonkey/source/modules/libimg/png/mozpngconf.h#115
27+
*
28+
* The list of relevant exported symbols can be had with this command:
29+
*
30+
nm pyexpat.so \
31+
| grep -v " [a-zBUA] " \
32+
| grep -v "_fini\|_init\|initpyexpat"
33+
*
34+
* If any of those symbols are NOT prefixed with "PyExpat_" then
35+
* a #define should be added for it here.
36+
*/
37+
38+
#ifndef PYEXPATNS_H
39+
#define PYEXPATNS_H
40+
41+
#define testingAccountingGetCountBytesDirect PyExpat_testingAccountingGetCountBytesDirect
42+
#define testingAccountingGetCountBytesIndirect PyExpat_testingAccountingGetCountBytesIndirect
43+
#define unsignedCharToPrintable PyExpat_unsignedCharToPrintable
44+
#define XML_DefaultCurrent PyExpat_XML_DefaultCurrent
45+
#define XML_ErrorString PyExpat_XML_ErrorString
46+
#define XML_ExpatVersion PyExpat_XML_ExpatVersion
47+
#define XML_ExpatVersionInfo PyExpat_XML_ExpatVersionInfo
48+
#define XML_ExternalEntityParserCreate PyExpat_XML_ExternalEntityParserCreate
49+
#define XML_FreeContentModel PyExpat_XML_FreeContentModel
50+
#define XML_GetBase PyExpat_XML_GetBase
51+
#define XML_GetBuffer PyExpat_XML_GetBuffer
52+
#define XML_GetCurrentByteCount PyExpat_XML_GetCurrentByteCount
53+
#define XML_GetCurrentByteIndex PyExpat_XML_GetCurrentByteIndex
54+
#define XML_GetCurrentColumnNumber PyExpat_XML_GetCurrentColumnNumber
55+
#define XML_GetCurrentLineNumber PyExpat_XML_GetCurrentLineNumber
56+
#define XML_GetErrorCode PyExpat_XML_GetErrorCode
57+
#define XML_GetFeatureList PyExpat_XML_GetFeatureList
58+
#define XML_GetIdAttributeIndex PyExpat_XML_GetIdAttributeIndex
59+
#define XML_GetInputContext PyExpat_XML_GetInputContext
60+
#define XML_GetParsingStatus PyExpat_XML_GetParsingStatus
61+
#define XML_GetSpecifiedAttributeCount PyExpat_XML_GetSpecifiedAttributeCount
62+
#define XmlGetUtf16InternalEncoding PyExpat_XmlGetUtf16InternalEncoding
63+
#define XmlGetUtf16InternalEncodingNS PyExpat_XmlGetUtf16InternalEncodingNS
64+
#define XmlGetUtf8InternalEncoding PyExpat_XmlGetUtf8InternalEncoding
65+
#define XmlGetUtf8InternalEncodingNS PyExpat_XmlGetUtf8InternalEncodingNS
66+
#define XmlInitEncoding PyExpat_XmlInitEncoding
67+
#define XmlInitEncodingNS PyExpat_XmlInitEncodingNS
68+
#define XmlInitUnknownEncoding PyExpat_XmlInitUnknownEncoding
69+
#define XmlInitUnknownEncodingNS PyExpat_XmlInitUnknownEncodingNS
70+
#define XML_MemFree PyExpat_XML_MemFree
71+
#define XML_MemMalloc PyExpat_XML_MemMalloc
72+
#define XML_MemRealloc PyExpat_XML_MemRealloc
73+
#define XML_Parse PyExpat_XML_Parse
74+
#define XML_ParseBuffer PyExpat_XML_ParseBuffer
75+
#define XML_ParserCreate PyExpat_XML_ParserCreate
76+
#define XML_ParserCreate_MM PyExpat_XML_ParserCreate_MM
77+
#define XML_ParserCreateNS PyExpat_XML_ParserCreateNS
78+
#define XML_ParserFree PyExpat_XML_ParserFree
79+
#define XML_ParserReset PyExpat_XML_ParserReset
80+
#define XmlParseXmlDecl PyExpat_XmlParseXmlDecl
81+
#define XmlParseXmlDeclNS PyExpat_XmlParseXmlDeclNS
82+
#define XmlPrologStateInit PyExpat_XmlPrologStateInit
83+
#define XmlPrologStateInitExternalEntity PyExpat_XmlPrologStateInitExternalEntity
84+
#define XML_ResumeParser PyExpat_XML_ResumeParser
85+
#define XML_SetAttlistDeclHandler PyExpat_XML_SetAttlistDeclHandler
86+
#define XML_SetBase PyExpat_XML_SetBase
87+
#define XML_SetBillionLaughsAttackProtectionActivationThreshold PyExpat_XML_SetBillionLaughsAttackProtectionActivationThreshold
88+
#define XML_SetBillionLaughsAttackProtectionMaximumAmplification PyExpat_XML_SetBillionLaughsAttackProtectionMaximumAmplification
89+
#define XML_SetCdataSectionHandler PyExpat_XML_SetCdataSectionHandler
90+
#define XML_SetCharacterDataHandler PyExpat_XML_SetCharacterDataHandler
91+
#define XML_SetCommentHandler PyExpat_XML_SetCommentHandler
92+
#define XML_SetDefaultHandler PyExpat_XML_SetDefaultHandler
93+
#define XML_SetDefaultHandlerExpand PyExpat_XML_SetDefaultHandlerExpand
94+
#define XML_SetDoctypeDeclHandler PyExpat_XML_SetDoctypeDeclHandler
95+
#define XML_SetElementDeclHandler PyExpat_XML_SetElementDeclHandler
96+
#define XML_SetElementHandler PyExpat_XML_SetElementHandler
97+
#define XML_SetEncoding PyExpat_XML_SetEncoding
98+
#define XML_SetEndCdataSectionHandler PyExpat_XML_SetEndCdataSectionHandler
99+
#define XML_SetEndDoctypeDeclHandler PyExpat_XML_SetEndDoctypeDeclHandler
100+
#define XML_SetEndElementHandler PyExpat_XML_SetEndElementHandler
101+
#define XML_SetEndNamespaceDeclHandler PyExpat_XML_SetEndNamespaceDeclHandler
102+
#define XML_SetEntityDeclHandler PyExpat_XML_SetEntityDeclHandler
103+
#define XML_SetExternalEntityRefHandler PyExpat_XML_SetExternalEntityRefHandler
104+
#define XML_SetExternalEntityRefHandlerArg PyExpat_XML_SetExternalEntityRefHandlerArg
105+
#define XML_SetHashSalt PyExpat_XML_SetHashSalt
106+
#define XML_SetNamespaceDeclHandler PyExpat_XML_SetNamespaceDeclHandler
107+
#define XML_SetNotationDeclHandler PyExpat_XML_SetNotationDeclHandler
108+
#define XML_SetNotStandaloneHandler PyExpat_XML_SetNotStandaloneHandler
109+
#define XML_SetParamEntityParsing PyExpat_XML_SetParamEntityParsing
110+
#define XML_SetProcessingInstructionHandler PyExpat_XML_SetProcessingInstructionHandler
111+
#define XML_SetReturnNSTriplet PyExpat_XML_SetReturnNSTriplet
112+
#define XML_SetSkippedEntityHandler PyExpat_XML_SetSkippedEntityHandler
113+
#define XML_SetStartCdataSectionHandler PyExpat_XML_SetStartCdataSectionHandler
114+
#define XML_SetStartDoctypeDeclHandler PyExpat_XML_SetStartDoctypeDeclHandler
115+
#define XML_SetStartElementHandler PyExpat_XML_SetStartElementHandler
116+
#define XML_SetStartNamespaceDeclHandler PyExpat_XML_SetStartNamespaceDeclHandler
117+
#define XML_SetUnknownEncodingHandler PyExpat_XML_SetUnknownEncodingHandler
118+
#define XML_SetUnparsedEntityDeclHandler PyExpat_XML_SetUnparsedEntityDeclHandler
119+
#define XML_SetUserData PyExpat_XML_SetUserData
120+
#define XML_SetXmlDeclHandler PyExpat_XML_SetXmlDeclHandler
121+
#define XmlSizeOfUnknownEncoding PyExpat_XmlSizeOfUnknownEncoding
122+
#define XML_StopParser PyExpat_XML_StopParser
123+
#define XML_UseForeignDTD PyExpat_XML_UseForeignDTD
124+
#define XML_UseParserAsHandlerArg PyExpat_XML_UseParserAsHandlerArg
125+
#define XmlUtf16Encode PyExpat_XmlUtf16Encode
126+
#define XmlUtf8Encode PyExpat_XmlUtf8Encode
127+
128+
129+
#endif /* !PYEXPATNS_H */
130+

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key);
318318

319319
/* Takes an arbitrary object which must support the (character, single segment)
320320
buffer interface and returns a pointer to a read-only memory location
321-
useable as character based input for subsequent processing.
321+
usable as character based input for subsequent processing.
322322
323323
Return 0 on success. buffer and buffer_len are only set in case no error
324324
occurs. Otherwise, -1 is returned and an exception set. */
@@ -371,11 +371,21 @@ PyAPI_FUNC(PyObject *) PyObject_Format(PyObject *obj,
371371
returns itself. */
372372
PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *);
373373

374-
/* Returns 1 if the object 'obj' provides iterator protocols, and 0 otherwise.
374+
/* Takes an AsyncIterable object and returns an AsyncIterator for it.
375+
This is typically a new iterator but if the argument is an AsyncIterator,
376+
this returns itself. */
377+
PyAPI_FUNC(PyObject *) PyObject_GetAIter(PyObject *);
378+
379+
/* Returns non-zero if the object 'obj' provides iterator protocols, and 0 otherwise.
375380
376381
This function always succeeds. */
377382
PyAPI_FUNC(int) PyIter_Check(PyObject *);
378383

384+
/* Returns non-zero if the object 'obj' provides AsyncIterator protocols, and 0 otherwise.
385+
386+
This function always succeeds. */
387+
PyAPI_FUNC(int) PyAIter_Check(PyObject *);
388+
379389
/* Takes an iterator object and calls its tp_iternext slot,
380390
returning the next value.
381391
@@ -385,6 +395,19 @@ PyAPI_FUNC(int) PyIter_Check(PyObject *);
385395
NULL with an exception means an error occurred. */
386396
PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
387397

398+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
399+
400+
/* Takes generator, coroutine or iterator object and sends the value into it.
401+
Returns:
402+
- PYGEN_RETURN (0) if generator has returned.
403+
'result' parameter is filled with return value
404+
- PYGEN_ERROR (-1) if exception was raised.
405+
'result' parameter is NULL
406+
- PYGEN_NEXT (1) if generator has yielded.
407+
'result' parameter is filled with yielded value. */
408+
PyAPI_FUNC(PySendResult) PyIter_Send(PyObject *, PyObject *, PyObject **);
409+
#endif
410+
388411

389412
/* === Number Protocol ================================================== */
390413

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,24 @@ PyAPI_DATA(PyTypeObject) PyBool_Type;
1515
Don't forget to apply Py_INCREF() when returning either!!! */
1616

1717
/* Don't use these directly */
18-
PyAPI_DATA(struct _longobject) _Py_FalseStruct, _Py_TrueStruct;
18+
PyAPI_DATA(struct _longobject) _Py_FalseStruct;
19+
PyAPI_DATA(struct _longobject) _Py_TrueStruct;
1920

2021
/* Use these macros */
2122
#define Py_False ((PyObject *) &_Py_FalseStruct)
2223
#define Py_True ((PyObject *) &_Py_TrueStruct)
2324

25+
// Test if an object is the True singleton, the same as "x is True" in Python.
26+
PyAPI_FUNC(int) Py_IsTrue(PyObject *x);
27+
#define Py_IsTrue(x) Py_Is((x), Py_True)
28+
29+
// Test if an object is the False singleton, the same as "x is False" in Python.
30+
PyAPI_FUNC(int) Py_IsFalse(PyObject *x);
31+
#define Py_IsFalse(x) Py_Is((x), Py_False)
32+
2433
/* Macros for returning Py_True or Py_False, respectively */
25-
#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
26-
#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
34+
#define Py_RETURN_TRUE return Py_NewRef(Py_True)
35+
#define Py_RETURN_FALSE return Py_NewRef(Py_False)
2736

2837
/* Function to return a bool from a C long */
2938
PyAPI_FUNC(PyObject *) PyBool_FromLong(long);

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

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
/* Bytes (String) object interface */
2+
/* Bytes object interface */
33

44
#ifndef Py_BYTESOBJECT_H
55
#define Py_BYTESOBJECT_H
@@ -10,23 +10,20 @@ extern "C" {
1010
#include <stdarg.h>
1111

1212
/*
13-
Type PyBytesObject represents a character string. An extra zero byte is
13+
Type PyBytesObject represents a byte string. An extra zero byte is
1414
reserved at the end to ensure it is zero-terminated, but a size is
1515
present so strings with null bytes in them can be represented. This
1616
is an immutable object type.
1717
18-
There are functions to create new string objects, to test
19-
an object for string-ness, and to get the
20-
string value. The latter function returns a null pointer
18+
There are functions to create new bytes objects, to test
19+
an object for bytes-ness, and to get the
20+
byte string value. The latter function returns a null pointer
2121
if the object is not of the proper type.
2222
There is a variant that takes an explicit size as well as a
2323
variant that assumes a zero-terminated string. Note that none of the
24-
functions should be applied to nil objects.
24+
functions should be applied to NULL pointer.
2525
*/
2626

27-
/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
28-
This significantly speeds up dict lookups. */
29-
3027
PyAPI_DATA(PyTypeObject) PyBytes_Type;
3128
PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
3229

@@ -50,26 +47,16 @@ PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
5047
const char *, Py_ssize_t,
5148
const char *);
5249

53-
/* Provides access to the internal data buffer and size of a string
54-
object or the default encoded version of a Unicode object. Passing
55-
NULL as *len parameter will force the string buffer to be
56-
0-terminated (passing a string with embedded NULL characters will
50+
/* Provides access to the internal data buffer and size of a bytes object.
51+
Passing NULL as len parameter will force the string buffer to be
52+
0-terminated (passing a string with embedded NUL characters will
5753
cause an exception). */
5854
PyAPI_FUNC(int) PyBytes_AsStringAndSize(
59-
PyObject *obj, /* string or Unicode object */
55+
PyObject *obj, /* bytes object */
6056
char **s, /* pointer to buffer variable */
61-
Py_ssize_t *len /* pointer to length variable or NULL
62-
(only possible for 0-terminated
63-
strings) */
57+
Py_ssize_t *len /* pointer to length variable or NULL */
6458
);
6559

66-
/* Flags used by string formatting */
67-
#define F_LJUST (1<<0)
68-
#define F_SIGN (1<<1)
69-
#define F_BLANK (1<<2)
70-
#define F_ALT (1<<3)
71-
#define F_ZERO (1<<4)
72-
7360
#ifndef Py_LIMITED_API
7461
# define Py_CPYTHON_BYTESOBJECT_H
7562
# include "cpython/bytesobject.h"

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ PyAPI_FUNC(int) Py_GetRecursionLimit(void);
6767
PyAPI_FUNC(int) Py_EnterRecursiveCall(const char *where);
6868
PyAPI_FUNC(void) Py_LeaveRecursiveCall(void);
6969

70-
#define Py_ALLOW_RECURSION \
71-
do { unsigned char _old = PyThreadState_GET()->recursion_critical;\
72-
PyThreadState_GET()->recursion_critical = 1;
73-
74-
#define Py_END_ALLOW_RECURSION \
75-
PyThreadState_GET()->recursion_critical = _old; \
76-
} while(0);
77-
7870
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
7971
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
8072

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ PyAPI_FUNC(int) PyCodec_Register(
2727
PyObject *search_function
2828
);
2929

30+
/* Unregister a codec search function and clear the registry's cache.
31+
If the search function is not registered, do nothing.
32+
Return 0 on success. Raise an exception and return -1 on error. */
33+
34+
PyAPI_FUNC(int) PyCodec_Unregister(
35+
PyObject *search_function
36+
);
37+
3038
/* Codec registry lookup API.
3139
3240
Looks up the given encoding and returns a CodecInfo object with

0 commit comments

Comments
 (0)