Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion graalpython/com.oracle.graal.python.cext/include/Python.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2022, 2024, Oracle and/or its affiliates.
/* Copyright (c) 2022, 2026, Oracle and/or its affiliates.
* Copyright (C) 1996-2022 Python Software Foundation
*
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
Expand Down Expand Up @@ -100,6 +100,7 @@ struct timeval;
#include "pythonrun.h"
#include "pylifecycle.h"
#include "ceval.h"
#include "intrcheck.h"
#include "sysmodule.h"
#include "osmodule.h"
#include "import.h"
Expand Down
34 changes: 34 additions & 0 deletions graalpython/com.oracle.graal.python.cext/include/intrcheck.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* Copyright (c) 2026, Oracle and/or its affiliates.
* Copyright (C) 1996-2020 Python Software Foundation
*
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
*/

#ifndef Py_INTRCHECK_H
#define Py_INTRCHECK_H
#ifdef __cplusplus
extern "C" {
#endif

PyAPI_FUNC(int) PyOS_InterruptOccurred(void);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
PyAPI_FUNC(void) PyOS_BeforeFork(void);
PyAPI_FUNC(void) PyOS_AfterFork_Parent(void);
PyAPI_FUNC(void) PyOS_AfterFork_Child(void);
#endif
/* Deprecated, please use PyOS_AfterFork_Child() instead */
Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyOS_AfterFork(void);

#ifndef Py_LIMITED_API
PyAPI_FUNC(int) _PyOS_IsMainThread(void);

#ifdef MS_WINDOWS
/* windows.h is not included by Python.h so use void* instead of HANDLE */
PyAPI_FUNC(void*) _PyOS_SigintEvent(void);
#endif
#endif /* !Py_LIMITED_API */

#ifdef __cplusplus
}
#endif
#endif /* !Py_INTRCHECK_H */
32 changes: 31 additions & 1 deletion graalpython/com.oracle.graal.python.cext/src/pylifecycle.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down Expand Up @@ -73,6 +73,36 @@ _Py_IsFinalizing(void)
return graalpy_finalizing;
}

static void
graalpy_fork_not_supported(void)
{
PyErr_SetString(PyExc_SystemError, "fork is not supported by GraalPy");
}

void
PyOS_BeforeFork(void)
{
graalpy_fork_not_supported();
}

void
PyOS_AfterFork_Parent(void)
{
graalpy_fork_not_supported();
}

void
PyOS_AfterFork_Child(void)
{
graalpy_fork_not_supported();
}

void
PyOS_AfterFork(void)
{
PyOS_AfterFork_Child();
}

void _Py_NO_RETURN _Py_FatalErrorFunc(const char *func, const char *msg) {
const char *prefix1 = "", *prefix2 = "";
if (func) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,10 @@ public final class CApiFunction {
@CApiBuiltin(name = "PyODict_DelItem", ret = Int, args = {PyObject, PyObject}, call = NotImplemented)
@CApiBuiltin(name = "PyODict_New", ret = PyObject, args = {}, call = NotImplemented)
@CApiBuiltin(name = "PyODict_SetItem", ret = Int, args = {PyObject, PyObject, PyObject}, call = NotImplemented)
@CApiBuiltin(name = "PyOS_AfterFork", ret = Void, args = {}, call = NotImplemented)
@CApiBuiltin(name = "PyOS_AfterFork_Child", ret = Void, args = {}, call = NotImplemented)
@CApiBuiltin(name = "PyOS_AfterFork_Parent", ret = Void, args = {}, call = NotImplemented)
@CApiBuiltin(name = "PyOS_BeforeFork", ret = Void, args = {}, call = NotImplemented)
@CApiBuiltin(name = "PyOS_AfterFork", ret = Void, args = {}, call = CImpl)
@CApiBuiltin(name = "PyOS_AfterFork_Child", ret = Void, args = {}, call = CImpl)
@CApiBuiltin(name = "PyOS_AfterFork_Parent", ret = Void, args = {}, call = CImpl)
@CApiBuiltin(name = "PyOS_BeforeFork", ret = Void, args = {}, call = CImpl)
@CApiBuiltin(name = "PyOS_InterruptOccurred", ret = Int, args = {}, call = NotImplemented)
@CApiBuiltin(name = "PyOS_Readline", ret = CHAR_PTR, args = {FILE_PTR, FILE_PTR, ConstCharPtrAsTruffleString}, call = NotImplemented)
@CApiBuiltin(name = "PyOS_getsig", ret = PY_OS_SIGHANDLER, args = {Int}, call = NotImplemented)
Expand Down
1 change: 1 addition & 0 deletions mx.graalpython/copyrights/overrides
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ graalpython/com.oracle.graal.python.cext/include/internal/pycore_typeobject.h,py
graalpython/com.oracle.graal.python.cext/include/internal/pycore_ucnhash.h,python.copyright
graalpython/com.oracle.graal.python.cext/include/internal/pycore_unicodeobject.h,python.copyright
graalpython/com.oracle.graal.python.cext/include/internal/pycore_warnings.h,python.copyright
graalpython/com.oracle.graal.python.cext/include/intrcheck.h,python.copyright
graalpython/com.oracle.graal.python.cext/include/iterobject.h,python.copyright
graalpython/com.oracle.graal.python.cext/include/listobject.h,python.copyright
graalpython/com.oracle.graal.python.cext/include/longobject.h,python.copyright
Expand Down
Loading