Skip to content

Commit a7fc676

Browse files
fangerertimfel
authored andcommitted
Merge branch 'master'
2 parents 69514f4 + 43ce485 commit a7fc676

File tree

70 files changed

+2040
-954
lines changed

Some content is hidden

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

70 files changed

+2040
-954
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "d90fe739f07cf57e6e8779e31b2ee6e3d543ed50" }
1+
{ "overlay": "29ac25e29ab69b45b98ba7c1ec9fac62e30c8cf2" }

graalpython/com.oracle.graal.python.cext/include/hpy/cpython/autogen_api_impl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,14 +656,14 @@ HPyAPI_FUNC int HPyCapsule_IsValid(HPyContext *ctx, HPy capsule, const char *nam
656656
return PyCapsule_IsValid(_h2py(capsule), name);
657657
}
658658

659-
HPyAPI_FUNC HPyThreadState HPy_LeavePythonExecution(HPyContext *ctx)
659+
HPyAPI_FUNC void HPy_ReenterPythonExecution(HPyContext *ctx, HPyThreadState state)
660660
{
661-
return _threads2h(PyEval_SaveThread());
661+
PyEval_RestoreThread(_h2threads(state));
662662
}
663663

664-
HPyAPI_FUNC void HPy_ReenterPythonExecution(HPyContext *ctx, HPyThreadState state)
664+
HPyAPI_FUNC HPyThreadState HPy_LeavePythonExecution(HPyContext *ctx)
665665
{
666-
PyEval_RestoreThread(_h2threads(state));
666+
return _threads2h(PyEval_SaveThread());
667667
}
668668

669669
HPyAPI_FUNC int HPyType_CheckSlot(HPyContext *ctx, HPy type, HPyDef *value)

graalpython/com.oracle.graal.python.cext/include/hpy/hpymodule.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,20 @@ typedef struct {
4949
} HPyModuleDef;
5050

5151

52+
#if defined(__cplusplus)
53+
# define HPyMODINIT_FUNC extern "C" Py_EXPORTED_SYMBOL HPy
54+
#else /* __cplusplus */
55+
# define HPyMODINIT_FUNC Py_EXPORTED_SYMBOL HPy
56+
#endif /* __cplusplus */
5257

5358
#ifdef HPY_UNIVERSAL_ABI
5459

5560
// module initialization in the universal case
5661
#define HPy_MODINIT(modname) \
5762
_HPy_HIDDEN HPyContext *_ctx_for_trampolines; \
5863
static HPy init_##modname##_impl(HPyContext *ctx); \
59-
Py_EXPORTED_SYMBOL \
60-
HPy HPyInit_##modname(HPyContext *ctx) \
64+
HPyMODINIT_FUNC \
65+
HPyInit_##modname(HPyContext *ctx) \
6166
{ \
6267
_ctx_for_trampolines = ctx; \
6368
return init_##modname##_impl(ctx); \

graalpython/com.oracle.graal.python.cext/include/hpy/inline_helpers.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343

4444
#include <assert.h>
4545

46+
#if defined(_MSC_VER)
47+
# include <malloc.h> /* for alloca() */
48+
#endif
49+
4650
HPyAPI_FUNC HPy HPyErr_SetFromErrno(HPyContext *ctx, HPy h_type)
4751
{
4852
return HPyErr_SetFromErrnoWithFilenameObjects(ctx, h_type, HPy_NULL, HPy_NULL);
@@ -92,4 +96,24 @@ HPyAPI_FUNC int HPySlice_AdjustIndices(HPy_ssize_t length, HPy_ssize_t *start, H
9296
return 0;
9397
}
9498

99+
HPyAPI_FUNC HPy HPyTuple_Pack(HPyContext *ctx, HPy_ssize_t n, ...) {
100+
va_list vargs;
101+
HPy_ssize_t i;
102+
103+
if (n == 0) {
104+
return HPyTuple_FromArray(ctx, (HPy*)NULL, n);
105+
}
106+
HPy *array = (HPy *)alloca(n * sizeof(HPy));
107+
va_start(vargs, n);
108+
if (array == NULL) {
109+
va_end(vargs);
110+
return HPy_NULL;
111+
}
112+
for (i = 0; i < n; i++) {
113+
array[i] = va_arg(vargs, HPy);
114+
}
115+
va_end(vargs);
116+
return HPyTuple_FromArray(ctx, array, n);
117+
}
118+
95119
#endif //HPY_INLINE_HELPERS_H

graalpython/com.oracle.graal.python.cext/include/hpy/macros.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@
3939
((void**)data) \
4040
))
4141

42-
43-
/* ~~~ HPyTuple_Pack ~~~
44-
45-
this is just syntactic sugar around HPyTuple_FromArray, to help porting the
46-
exising code which uses PyTuple_Pack
47-
*/
48-
49-
#define HPyTuple_Pack(ctx, n, ...) (HPyTuple_FromArray(ctx, (HPy[]){ __VA_ARGS__ }, n))
50-
5142
/* Rich comparison opcodes */
5243
typedef enum {
5344
HPy_LT = 0,

graalpython/com.oracle.graal.python.cext/include/hpy/universal/autogen_ctx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ struct _HPyContext_s {
302302
void (*ctx_Tracker_Close)(HPyContext *ctx, HPyTracker ht);
303303
void (*ctx_Field_Store)(HPyContext *ctx, HPy target_object, _HPyFieldPtr target_field, HPy h);
304304
HPy (*ctx_Field_Load)(HPyContext *ctx, HPy source_object, HPyField source_field);
305-
HPyThreadState (*ctx_LeavePythonExecution)(HPyContext *ctx);
306305
void (*ctx_ReenterPythonExecution)(HPyContext *ctx, HPyThreadState state);
306+
HPyThreadState (*ctx_LeavePythonExecution)(HPyContext *ctx);
307307
void (*ctx_Global_Store)(HPyContext *ctx, _HPyGlobalPtr global, HPy h);
308308
HPy (*ctx_Global_Load)(HPyContext *ctx, HPyGlobal global);
309309
void (*ctx_Dump)(HPyContext *ctx, HPy h);

graalpython/com.oracle.graal.python.cext/include/hpy/universal/autogen_trampolines.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,14 +724,14 @@ HPyAPI_FUNC HPy HPyField_Load(HPyContext *ctx, HPy source_object, HPyField sourc
724724
return WRAP(ctx->ctx_Field_Load ( ctx, UNWRAP(source_object), UNWRAP_FIELD(source_field) ));
725725
}
726726

727-
HPyAPI_FUNC HPyThreadState HPy_LeavePythonExecution(HPyContext *ctx) {
728-
return WRAP_THREADSTATE(ctx->ctx_LeavePythonExecution ( ctx ));
729-
}
730-
731727
HPyAPI_FUNC void HPy_ReenterPythonExecution(HPyContext *ctx, HPyThreadState state) {
732728
ctx->ctx_ReenterPythonExecution ( ctx, UNWRAP_THREADSTATE(state) );
733729
}
734730

731+
HPyAPI_FUNC HPyThreadState HPy_LeavePythonExecution(HPyContext *ctx) {
732+
return WRAP_THREADSTATE(ctx->ctx_LeavePythonExecution ( ctx ));
733+
}
734+
735735
HPyAPI_FUNC void HPyGlobal_Store(HPyContext *ctx, HPyGlobal *global, HPy h) {
736736
ctx->ctx_Global_Store ( ctx, global, UNWRAP(h) );
737737
}

graalpython/com.oracle.graal.python.cext/include/hpy/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
*/
2424

2525
// automatically generated by setup.py:get_scm_config()
26-
#define HPY_VERSION "0.0.4.dev260+ge3eb9de"
27-
#define HPY_GIT_REVISION "e3eb9de"
26+
#define HPY_VERSION "0.0.4"
27+
#define HPY_GIT_REVISION "41989b8"

graalpython/com.oracle.graal.python.cext/lzma/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
#define HAVE_FUTIMENS 1
7272
#define HAVE_GETTEXT 1
7373
#ifdef __aarch64__
74-
#define HAVE_IMMINTRIN_H 0
74+
#undef HAVE_IMMINTRIN_H
7575
#else
7676
#define HAVE_IMMINTRIN_H 1
7777
#endif

graalpython/com.oracle.graal.python.jni/src/ctx_tracker.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ ctx_Tracker_New(HPyContext *ctx, HPy_ssize_t capacity)
109109
}
110110
capacity++; // always reserve space for an extra handle, see the docs
111111

112-
hp = malloc(sizeof(_HPyTracker_s));
112+
hp = (_HPyTracker_s*)malloc(sizeof(_HPyTracker_s));
113113
if (hp == NULL) {
114114
HPyErr_NoMemory(ctx);
115115
return _hp2ht(0);
116116
}
117-
hp->handles = calloc(capacity, sizeof(HPy));
117+
hp->handles = (HPy*)calloc(capacity, sizeof(HPy));
118118
if (hp->handles == NULL) {
119119
free(hp);
120120
HPyErr_NoMemory(ctx);
@@ -142,7 +142,7 @@ tracker_resize(HPyContext *ctx, _HPyTracker_s *hp, HPy_ssize_t capacity)
142142
HPyErr_SetString(ctx, ctx->h_ValueError, "HPyTracker resize would lose handles");
143143
return -1;
144144
}
145-
new_handles = realloc(hp->handles, capacity * sizeof(HPy));
145+
new_handles = (HPy*)realloc(hp->handles, capacity * sizeof(HPy));
146146
if (new_handles == NULL) {
147147
HPyErr_NoMemory(ctx);
148148
return -1;

0 commit comments

Comments
 (0)