Skip to content

Commit 1413657

Browse files
committed
Update Python inlined files: 3.9
1 parent 1e968c6 commit 1413657

File tree

677 files changed

+65844
-41320
lines changed

Some content is hidden

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

677 files changed

+65844
-41320
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ extern "C" {
141141
#endif
142142

143143

144+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
145+
/* Call a callable Python object without any arguments */
146+
PyAPI_FUNC(PyObject *) PyObject_CallNoArgs(PyObject *func);
147+
#endif
148+
149+
144150
/* Call a callable Python object 'callable' with arguments given by the
145151
tuple 'args' and keywords arguments given by the dictionary 'kwargs'.
146152
@@ -696,7 +702,7 @@ PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m);
696702
(PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
697703

698704
/* Return a pointer to the underlying item array for
699-
an object retured by PySequence_Fast */
705+
an object returned by PySequence_Fast */
700706
#define PySequence_Fast_ITEMS(sf) \
701707
(PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \
702708
: ((PyTupleObject *)(sf))->ob_item)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern "C" {
99

1010
PyAPI_DATA(PyTypeObject) PyBool_Type;
1111

12-
#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type)
12+
#define PyBool_Check(x) Py_IS_TYPE(x, &PyBool_Type)
1313

1414
/* Py_False and Py_True are the only two bools in existence.
1515
Don't forget to apply Py_INCREF() when returning either!!! */

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

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,13 @@ extern "C" {
1818
* to contain a char pointer, not an unsigned char pointer.
1919
*/
2020

21-
/* Object layout */
22-
#ifndef Py_LIMITED_API
23-
typedef struct {
24-
PyObject_VAR_HEAD
25-
Py_ssize_t ob_alloc; /* How many bytes allocated in ob_bytes */
26-
char *ob_bytes; /* Physical backing buffer */
27-
char *ob_start; /* Logical start inside ob_bytes */
28-
/* XXX(nnorwitz): should ob_exports be Py_ssize_t? */
29-
int ob_exports; /* How many buffer exports */
30-
} PyByteArrayObject;
31-
#endif
32-
3321
/* Type object */
3422
PyAPI_DATA(PyTypeObject) PyByteArray_Type;
3523
PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type;
3624

3725
/* Type check macros */
3826
#define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type)
39-
#define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type)
27+
#define PyByteArray_CheckExact(self) Py_IS_TYPE(self, &PyByteArray_Type)
4028

4129
/* Direct API functions */
4230
PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *);
@@ -46,14 +34,10 @@ PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *);
4634
PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *);
4735
PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t);
4836

49-
/* Macros, trading safety for speed */
5037
#ifndef Py_LIMITED_API
51-
#define PyByteArray_AS_STRING(self) \
52-
(assert(PyByteArray_Check(self)), \
53-
Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_start : _PyByteArray_empty_string)
54-
#define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)), Py_SIZE(self))
55-
56-
PyAPI_DATA(char) _PyByteArray_empty_string[];
38+
# define Py_CPYTHON_BYTEARRAYOBJECT_H
39+
# include "cpython/bytearrayobject.h"
40+
# undef Py_CPYTHON_BYTEARRAYOBJECT_H
5741
#endif
5842

5943
#ifdef __cplusplus

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

Lines changed: 5 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,12 @@ functions should be applied to nil objects.
2727
/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
2828
This significantly speeds up dict lookups. */
2929

30-
#ifndef Py_LIMITED_API
31-
typedef struct {
32-
PyObject_VAR_HEAD
33-
Py_hash_t ob_shash;
34-
char ob_sval[1];
35-
36-
/* Invariants:
37-
* ob_sval contains space for 'ob_size+1' elements.
38-
* ob_sval[ob_size] == 0.
39-
* ob_shash is the hash of the string or -1 if not computed yet.
40-
*/
41-
} PyBytesObject;
42-
#endif
43-
4430
PyAPI_DATA(PyTypeObject) PyBytes_Type;
4531
PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
4632

4733
#define PyBytes_Check(op) \
4834
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
49-
#define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type)
35+
#define PyBytes_CheckExact(op) Py_IS_TYPE(op, &PyBytes_Type)
5036

5137
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
5238
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
@@ -60,40 +46,9 @@ PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
6046
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
6147
PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);
6248
PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);
63-
#ifndef Py_LIMITED_API
64-
PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);
65-
PyAPI_FUNC(PyObject*) _PyBytes_FormatEx(
66-
const char *format,
67-
Py_ssize_t format_len,
68-
PyObject *args,
69-
int use_bytearray);
70-
PyAPI_FUNC(PyObject*) _PyBytes_FromHex(
71-
PyObject *string,
72-
int use_bytearray);
73-
#endif
7449
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
7550
const char *, Py_ssize_t,
7651
const char *);
77-
#ifndef Py_LIMITED_API
78-
/* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */
79-
PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t,
80-
const char *, Py_ssize_t,
81-
const char *,
82-
const char **);
83-
#endif
84-
85-
/* Macro, trading safety for speed */
86-
#ifndef Py_LIMITED_API
87-
#define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \
88-
(((PyBytesObject *)(op))->ob_sval))
89-
#define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op))
90-
#endif
91-
92-
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
93-
x must be an iterable object. */
94-
#ifndef Py_LIMITED_API
95-
PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
96-
#endif
9752

9853
/* Provides access to the internal data buffer and size of a string
9954
object or the default encoded version of a Unicode object. Passing
@@ -108,28 +63,6 @@ PyAPI_FUNC(int) PyBytes_AsStringAndSize(
10863
strings) */
10964
);
11065

111-
/* Using the current locale, insert the thousands grouping
112-
into the string pointed to by buffer. For the argument descriptions,
113-
see Objects/stringlib/localeutil.h */
114-
#ifndef Py_LIMITED_API
115-
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer,
116-
Py_ssize_t n_buffer,
117-
char *digits,
118-
Py_ssize_t n_digits,
119-
Py_ssize_t min_width);
120-
121-
/* Using explicit passed-in values, insert the thousands grouping
122-
into the string pointed to by buffer. For the argument descriptions,
123-
see Objects/stringlib/localeutil.h */
124-
PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer,
125-
Py_ssize_t n_buffer,
126-
char *digits,
127-
Py_ssize_t n_digits,
128-
Py_ssize_t min_width,
129-
const char *grouping,
130-
const char *thousands_sep);
131-
#endif
132-
13366
/* Flags used by string formatting */
13467
#define F_LJUST (1<<0)
13568
#define F_SIGN (1<<1)
@@ -138,85 +71,10 @@ PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer,
13871
#define F_ZERO (1<<4)
13972

14073
#ifndef Py_LIMITED_API
141-
/* The _PyBytesWriter structure is big: it contains an embedded "stack buffer".
142-
A _PyBytesWriter variable must be declared at the end of variables in a
143-
function to optimize the memory allocation on the stack. */
144-
typedef struct {
145-
/* bytes, bytearray or NULL (when the small buffer is used) */
146-
PyObject *buffer;
147-
148-
/* Number of allocated size. */
149-
Py_ssize_t allocated;
150-
151-
/* Minimum number of allocated bytes,
152-
incremented by _PyBytesWriter_Prepare() */
153-
Py_ssize_t min_size;
154-
155-
/* If non-zero, use a bytearray instead of a bytes object for buffer. */
156-
int use_bytearray;
157-
158-
/* If non-zero, overallocate the buffer (default: 0).
159-
This flag must be zero if use_bytearray is non-zero. */
160-
int overallocate;
161-
162-
/* Stack buffer */
163-
int use_small_buffer;
164-
char small_buffer[512];
165-
} _PyBytesWriter;
166-
167-
/* Initialize a bytes writer
168-
169-
By default, the overallocation is disabled. Set the overallocate attribute
170-
to control the allocation of the buffer. */
171-
PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter *writer);
172-
173-
/* Get the buffer content and reset the writer.
174-
Return a bytes object, or a bytearray object if use_bytearray is non-zero.
175-
Raise an exception and return NULL on error. */
176-
PyAPI_FUNC(PyObject *) _PyBytesWriter_Finish(_PyBytesWriter *writer,
177-
void *str);
178-
179-
/* Deallocate memory of a writer (clear its internal buffer). */
180-
PyAPI_FUNC(void) _PyBytesWriter_Dealloc(_PyBytesWriter *writer);
181-
182-
/* Allocate the buffer to write size bytes.
183-
Return the pointer to the beginning of buffer data.
184-
Raise an exception and return NULL on error. */
185-
PyAPI_FUNC(void*) _PyBytesWriter_Alloc(_PyBytesWriter *writer,
186-
Py_ssize_t size);
187-
188-
/* Ensure that the buffer is large enough to write *size* bytes.
189-
Add size to the writer minimum size (min_size attribute).
190-
191-
str is the current pointer inside the buffer.
192-
Return the updated current pointer inside the buffer.
193-
Raise an exception and return NULL on error. */
194-
PyAPI_FUNC(void*) _PyBytesWriter_Prepare(_PyBytesWriter *writer,
195-
void *str,
196-
Py_ssize_t size);
197-
198-
/* Resize the buffer to make it larger.
199-
The new buffer may be larger than size bytes because of overallocation.
200-
Return the updated current pointer inside the buffer.
201-
Raise an exception and return NULL on error.
202-
203-
Note: size must be greater than the number of allocated bytes in the writer.
204-
205-
This function doesn't use the writer minimum size (min_size attribute).
206-
207-
See also _PyBytesWriter_Prepare().
208-
*/
209-
PyAPI_FUNC(void*) _PyBytesWriter_Resize(_PyBytesWriter *writer,
210-
void *str,
211-
Py_ssize_t size);
212-
213-
/* Write bytes.
214-
Raise an exception and return NULL on error. */
215-
PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer,
216-
void *str,
217-
const void *bytes,
218-
Py_ssize_t size);
219-
#endif /* Py_LIMITED_API */
74+
# define Py_CPYTHON_BYTESOBJECT_H
75+
# include "cpython/bytesobject.h"
76+
# undef Py_CPYTHON_BYTESOBJECT_H
77+
#endif
22078

22179
#ifdef __cplusplus
22280
}

0 commit comments

Comments
 (0)