Skip to content

Commit e80f93f

Browse files
committed
Export functions used in downcalls
1 parent 98b8f51 commit e80f93f

File tree

6 files changed

+19
-12
lines changed

6 files changed

+19
-12
lines changed

graalpython/com.oracle.graal.python.cext/src/bytesobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,8 +2839,8 @@ _Py_COMP_DIAG_POP
28392839
}
28402840
#endif // GraalPy change
28412841

2842-
// GraalPy change: different signature, uses C array instead of bytes
2843-
PyObject *
2842+
// GraalPy change: export for downcall, uses C array instead of bytes
2843+
PyAPI_FUNC(PyObject *)
28442844
bytes_subtype_new(PyTypeObject *type, int8_t* contents, Py_ssize_t n) {
28452845
// GraalPy change: different implementation
28462846
PyObject* bytes = type->tp_alloc(type, n);

graalpython/com.oracle.graal.python.cext/src/exceptions.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -52,7 +52,8 @@ void initialize_exceptions() {
5252
#undef EXCEPTION
5353
}
5454

55-
PyObject* exception_subtype_new(PyTypeObject *type, PyObject *args) {
55+
PyAPI_FUNC(PyObject *)
56+
exception_subtype_new(PyTypeObject *type, PyObject *args) {
5657
PyBaseExceptionObject *self;
5758

5859
self = (PyBaseExceptionObject *)type->tp_alloc(type, 0);

graalpython/com.oracle.graal.python.cext/src/memoryobject.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3320,11 +3320,15 @@ PyTypeObject PyMemoryView_Type = {
33203320

33213321
// GraalPy additions
33223322
/* called from memoryview implementation to do pointer arithmetics currently not possible from Java */
3323-
int8_t* truffle_add_suboffset(int8_t *ptr, Py_ssize_t offset, Py_ssize_t suboffset) {
3323+
PyAPI_FUNC(int8_t *)
3324+
truffle_add_suboffset(int8_t *ptr, Py_ssize_t offset, Py_ssize_t suboffset)
3325+
{
33243326
return *(int8_t**)(ptr + offset) + suboffset;
33253327
}
33263328

3327-
PyObject* PyTruffle_MemoryViewFromObject(PyObject *v, int flags) {
3329+
PyAPI_FUNC(PyObject *)
3330+
PyTruffle_MemoryViewFromObject(PyObject *v, int flags)
3331+
{
33283332
if (PyObject_CheckBuffer(v)) {
33293333
Py_buffer* buffer = malloc(sizeof(Py_buffer));
33303334
if (PyObject_GetBuffer(v, buffer, flags) < 0) {
@@ -3364,7 +3368,9 @@ PyObject* PyTruffle_MemoryViewFromObject(PyObject *v, int flags) {
33643368
}
33653369

33663370
/* Release buffer struct allocated in PyTruffle_MemoryViewFromObject */
3367-
void PyTruffle_ReleaseBuffer(Py_buffer* buffer) {
3371+
PyAPI_FUNC(void)
3372+
PyTruffle_ReleaseBuffer(Py_buffer* buffer)
3373+
{
33683374
if (buffer->obj != NULL) {
33693375
PyBufferProcs *pb;
33703376
pb = Py_TYPE(buffer->obj)->tp_as_buffer;

graalpython/com.oracle.graal.python.cext/src/modsupport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static int getbuffer(PyObject *arg, Py_buffer *view, const char **errmsg) {
6868
return 0;
6969
}
7070

71-
int get_buffer_r(PyObject *arg, Py_buffer *view) {
71+
PyAPI_FUNC(int) get_buffer_r(PyObject *arg, Py_buffer *view) {
7272
if (PyObject_GetBuffer(arg, view, PyBUF_SIMPLE) != 0) {
7373
return -1;
7474
}
@@ -79,7 +79,7 @@ int get_buffer_r(PyObject *arg, Py_buffer *view) {
7979
return 0;
8080
}
8181

82-
int get_buffer_rw(PyObject *arg, Py_buffer *view) {
82+
PyAPI_FUNC(int) get_buffer_rw(PyObject *arg, Py_buffer *view) {
8383
if (PyObject_GetBuffer(arg, view, PyBUF_WRITABLE) != 0) {
8484
PyErr_Clear();
8585
return -1;
@@ -91,7 +91,7 @@ int get_buffer_rw(PyObject *arg, Py_buffer *view) {
9191
return 0;
9292
}
9393

94-
Py_ssize_t convertbuffer(PyObject *arg, const void **p) {
94+
PyAPI_FUNC(Py_ssize_t) convertbuffer(PyObject *arg, const void **p) {
9595
PyBufferProcs *pb = Py_TYPE(arg)->tp_as_buffer;
9696
Py_ssize_t count;
9797
Py_buffer view;

graalpython/com.oracle.graal.python.cext/src/tupleobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ tuple_vectorcall(PyObject *type, PyObject * const*args,
758758

759759
PyObject* PyTruffle_Tuple_Alloc(PyTypeObject* cls, Py_ssize_t nitems);
760760

761-
PyObject * // GraalPy change: not static
761+
PyAPI_FUNC(PyObject *) // GraalPy change: export for downcall
762762
tuple_subtype_new(PyTypeObject *type, PyObject *iterable)
763763
{
764764
// GraalPy change: different implementation

graalpython/com.oracle.graal.python.cext/src/unicodeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14461,7 +14461,7 @@ unicode_new_impl(PyTypeObject *type, PyObject *x, const char *encoding,
1446114461
}
1446214462
#endif // GraalPy change
1446314463

14464-
PyObject * // GraalPy change: not static
14464+
PyAPI_FUNC(PyObject *) // GraalPy change: export for downcall
1446514465
unicode_subtype_new(PyTypeObject *type, PyObject *unicode)
1446614466
{
1446714467
// GraalPy change: temporarily define struct access macros

0 commit comments

Comments
 (0)