Skip to content

Commit 1b13a95

Browse files
committed
Adjustments initconfig
1 parent 0778689 commit 1b13a95

File tree

7 files changed

+39
-31
lines changed

7 files changed

+39
-31
lines changed

graalpython/com.oracle.graal.python.cext/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ set(SRC_FILES ${CAPI_SRC}/codecs.c ${CAPI_SRC}/setobject.c ${CAPI_SRC}/compile.c
149149
${CAPI_SRC}/fileobject.c ${CAPI_SRC}/pystrcmp.c ${CAPI_SRC}/getversion.c
150150
${CAPI_SRC}/genobject.c ${CAPI_SRC}/methodobject.c ${CAPI_SRC}/boolobject.c ${CAPI_SRC}/pylifecycle.c
151151
${CAPI_SRC}/errors.c ${CAPI_SRC}/signals.c ${CAPI_SRC}/datetime.c ${CAPI_SRC}/call.c
152-
${CAPI_SRC}/getargs.c ${CAPI_SRC}/tracemalloc.c
152+
${CAPI_SRC}/getargs.c ${CAPI_SRC}/tracemalloc.c ${CAPI_SRC}/initconfig.c
153153
)
154154

155155
file(GLOB_RECURSE ACTUAL_SRC_FILES

graalpython/com.oracle.graal.python.cext/include/internal/pycore_initconfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/* Copyright (c) 2025, Oracle and/or its affiliates.
2+
* Copyright (C) 1996-2025 Python Software Foundation
3+
*
4+
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
5+
*/
16
#ifndef Py_INTERNAL_CORECONFIG_H
27
#define Py_INTERNAL_CORECONFIG_H
38
#ifdef __cplusplus

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

Lines changed: 1 addition & 17 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, 2025, 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
@@ -39,19 +39,3 @@
3939
* SOFTWARE.
4040
*/
4141
#include "capi.h"
42-
43-
int Py_DebugFlag = 0;
44-
int Py_VerboseFlag = 0;
45-
int Py_QuietFlag = 0;
46-
int Py_InteractiveFlag = 0;
47-
int Py_InspectFlag = 0;
48-
int Py_OptimizeFlag = 0;
49-
int Py_NoSiteFlag = 0;
50-
int Py_BytesWarningFlag = 0;
51-
int Py_FrozenFlag = 0;
52-
int Py_IgnoreEnvironmentFlag = 0;
53-
int Py_DontWriteBytecodeFlag = 0;
54-
int Py_NoUserSiteDirectory;
55-
int Py_UnbufferedStdioFlag = 0;
56-
int Py_HashRandomizationFlag = 0;
57-
int Py_IsolatedFlag = 0;

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1+
/* Copyright (c) 2025, Oracle and/or its affiliates.
2+
* Copyright (C) 1996-2025 Python Software Foundation
3+
*
4+
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
5+
*/
16
#include "Python.h"
27
#include "pycore_fileutils.h" // _Py_HasFileSystemDefaultEncodeErrors
8+
#if 0 // GraalPy change
39
#include "pycore_getopt.h" // _PyOS_GetOpt()
10+
#endif // GraalPy change
411
#include "pycore_initconfig.h" // _PyStatus_OK()
512
#include "pycore_interp.h" // _PyInterpreterState.runtime
613
#include "pycore_long.h" // _PY_LONG_MAX_STR_DIGITS_THRESHOLD
14+
#if 0 // GraalPy change
715
#include "pycore_pathconfig.h" // _Py_path_config
16+
#endif // GraalPy change
817
#include "pycore_pyerrors.h" // _PyErr_GetRaisedException()
18+
#if 0 // GraalPy change
919
#include "pycore_pylifecycle.h" // _Py_PreInitializeFromConfig()
20+
#endif // GraalPy change
1021
#include "pycore_pymem.h" // _PyMem_SetDefaultAllocator()
1122
#include "pycore_pystate.h" // _PyThreadState_GET()
1223

@@ -196,6 +207,7 @@ int Py_LegacyWindowsStdioFlag = 0; /* Uses FileIO instead of WindowsConsoleIO */
196207
#endif
197208

198209

210+
#if 0 // GraalPy change
199211
static PyObject *
200212
_Py_GetGlobalVariablesAsDict(void)
201213
{
@@ -269,6 +281,7 @@ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
269281
#undef SET_ITEM_STR
270282
_Py_COMP_DIAG_POP
271283
}
284+
#endif // GraalPy change
272285

273286
char*
274287
Py_GETENV(const char *name)
@@ -359,6 +372,7 @@ _PyWideStringList_Clear(PyWideStringList *list)
359372
}
360373

361374

375+
#if 0 // GraalPy change
362376
int
363377
_PyWideStringList_Copy(PyWideStringList *list, const PyWideStringList *list2)
364378
{
@@ -684,6 +698,7 @@ config_check_consistency(const PyConfig *config)
684698
}
685699
#endif
686700

701+
#endif // GraalPy change
687702

688703
/* Free memory allocated in config, but don't clear all attributes */
689704
void
@@ -837,6 +852,7 @@ PyConfig_InitIsolatedConfig(PyConfig *config)
837852
}
838853

839854

855+
#if 0 // GraalPy change
840856
/* Copy str into *config_str (duplicate the string) */
841857
PyStatus
842858
PyConfig_SetString(PyConfig *config, wchar_t **config_str, const wchar_t *str)
@@ -3178,3 +3194,4 @@ _Py_DumpPathConfig(PyThreadState *tstate)
31783194

31793195
_PyErr_SetRaisedException(tstate, exc);
31803196
}
3197+
#endif // GraalPy change

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3879,13 +3879,15 @@ PyUnicode_WriteChar(PyObject *unicode, Py_ssize_t index, Py_UCS4 ch)
38793879
index, ch);
38803880
return 0;
38813881
}
3882+
#endif // GraalPy change
38823883

38833884
const char *
38843885
PyUnicode_GetDefaultEncoding(void)
38853886
{
38863887
return "utf-8";
38873888
}
38883889

3890+
#if 0 // GraalPy change
38893891
/* create or adjust a UnicodeDecodeError */
38903892
static void
38913893
make_decode_exception(PyObject **exceptionObject,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CApiFunction.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -725,9 +725,9 @@ public final class CApiFunction {
725725
@CApiBuiltin(name = "PyCodec_XMLCharRefReplaceErrors", ret = PyObject, args = {PyObject}, call = NotImplemented)
726726
@CApiBuiltin(name = "PyCompile_OpcodeStackEffect", ret = Int, args = {Int, Int}, call = NotImplemented)
727727
@CApiBuiltin(name = "PyCompile_OpcodeStackEffectWithJump", ret = Int, args = {Int, Int, Int}, call = NotImplemented)
728-
@CApiBuiltin(name = "PyConfig_Clear", ret = Void, args = {PYCONFIG_PTR}, call = NotImplemented)
729-
@CApiBuiltin(name = "PyConfig_InitIsolatedConfig", ret = Void, args = {PYCONFIG_PTR}, call = NotImplemented)
730-
@CApiBuiltin(name = "PyConfig_InitPythonConfig", ret = Void, args = {PYCONFIG_PTR}, call = NotImplemented)
728+
@CApiBuiltin(name = "PyConfig_Clear", ret = Void, args = {PYCONFIG_PTR}, call = CImpl)
729+
@CApiBuiltin(name = "PyConfig_InitIsolatedConfig", ret = Void, args = {PYCONFIG_PTR}, call = CImpl)
730+
@CApiBuiltin(name = "PyConfig_InitPythonConfig", ret = Void, args = {PYCONFIG_PTR}, call = CImpl)
731731
@CApiBuiltin(name = "PyConfig_Read", ret = PYSTATUS, args = {PYCONFIG_PTR}, call = NotImplemented)
732732
@CApiBuiltin(name = "PyConfig_SetArgv", ret = PYSTATUS, args = {PYCONFIG_PTR, Py_ssize_t, WCHAR_T_CONST_PTR}, call = NotImplemented)
733733
@CApiBuiltin(name = "PyConfig_SetBytesArgv", ret = PYSTATUS, args = {PYCONFIG_PTR, Py_ssize_t, CHAR_CONST_PTR}, call = NotImplemented)
@@ -878,13 +878,13 @@ public final class CApiFunction {
878878
@CApiBuiltin(name = "PySignal_SetWakeupFd", ret = Int, args = {Int}, call = NotImplemented)
879879
@CApiBuiltin(name = "PySlice_GetIndices", ret = Int, args = {PyObject, Py_ssize_t, PY_SSIZE_T_PTR, PY_SSIZE_T_PTR, PY_SSIZE_T_PTR}, call = NotImplemented)
880880
@CApiBuiltin(name = "PySlice_GetIndicesEx", ret = Int, args = {PyObject, Py_ssize_t, PY_SSIZE_T_PTR, PY_SSIZE_T_PTR, PY_SSIZE_T_PTR, PY_SSIZE_T_PTR}, call = NotImplemented)
881-
@CApiBuiltin(name = "PyStatus_Error", ret = PYSTATUS, args = {ConstCharPtr}, call = NotImplemented)
882-
@CApiBuiltin(name = "PyStatus_Exception", ret = Int, args = {PYSTATUS}, call = NotImplemented)
883-
@CApiBuiltin(name = "PyStatus_Exit", ret = PYSTATUS, args = {Int}, call = NotImplemented)
884-
@CApiBuiltin(name = "PyStatus_IsError", ret = Int, args = {PYSTATUS}, call = NotImplemented)
885-
@CApiBuiltin(name = "PyStatus_IsExit", ret = Int, args = {PYSTATUS}, call = NotImplemented)
886-
@CApiBuiltin(name = "PyStatus_NoMemory", ret = PYSTATUS, args = {}, call = NotImplemented)
887-
@CApiBuiltin(name = "PyStatus_Ok", ret = PYSTATUS, args = {}, call = NotImplemented)
881+
@CApiBuiltin(name = "PyStatus_Error", ret = PYSTATUS, args = {ConstCharPtr}, call = CImpl)
882+
@CApiBuiltin(name = "PyStatus_Exception", ret = Int, args = {PYSTATUS}, call = CImpl)
883+
@CApiBuiltin(name = "PyStatus_Exit", ret = PYSTATUS, args = {Int}, call = CImpl)
884+
@CApiBuiltin(name = "PyStatus_IsError", ret = Int, args = {PYSTATUS}, call = CImpl)
885+
@CApiBuiltin(name = "PyStatus_IsExit", ret = Int, args = {PYSTATUS}, call = CImpl)
886+
@CApiBuiltin(name = "PyStatus_NoMemory", ret = PYSTATUS, args = {}, call = CImpl)
887+
@CApiBuiltin(name = "PyStatus_Ok", ret = PYSTATUS, args = {}, call = CImpl)
888888
@CApiBuiltin(name = "PySys_AddAuditHook", ret = Int, args = {PY_AUDITHOOKFUNCTION, Pointer}, call = NotImplemented)
889889
@CApiBuiltin(name = "PySys_AddWarnOption", ret = Void, args = {CONST_WCHAR_PTR}, call = NotImplemented)
890890
@CApiBuiltin(name = "PySys_AddWarnOptionUnicode", ret = Void, args = {PyObject}, call = NotImplemented)
@@ -962,7 +962,7 @@ public final class CApiFunction {
962962
@CApiBuiltin(name = "PyUnicode_DecodeUnicodeEscape", ret = PyObject, args = {ConstCharPtrAsTruffleString, Py_ssize_t, ConstCharPtrAsTruffleString}, call = NotImplemented)
963963
@CApiBuiltin(name = "PyUnicode_FSDecoder", ret = Int, args = {PyObject, Pointer}, call = NotImplemented)
964964
@CApiBuiltin(name = "PyUnicode_Fill", ret = Py_ssize_t, args = {PyObject, Py_ssize_t, Py_ssize_t, PY_UCS4}, call = CImpl)
965-
@CApiBuiltin(name = "PyUnicode_GetDefaultEncoding", ret = ConstCharPtrAsTruffleString, args = {}, call = NotImplemented)
965+
@CApiBuiltin(name = "PyUnicode_GetDefaultEncoding", ret = ConstCharPtrAsTruffleString, args = {}, call = CImpl)
966966
@CApiBuiltin(name = "PyUnicode_IsIdentifier", ret = Int, args = {PyObject}, call = NotImplemented)
967967
@CApiBuiltin(name = "PyUnicode_Partition", ret = PyObject, args = {PyObject, PyObject}, call = NotImplemented)
968968
@CApiBuiltin(name = "PyUnicode_RPartition", ret = PyObject, args = {PyObject, PyObject}, call = NotImplemented)
@@ -988,7 +988,7 @@ public final class CApiFunction {
988988
@CApiBuiltin(name = "Py_Finalize", ret = Void, args = {}, call = NotImplemented)
989989
@CApiBuiltin(name = "Py_FinalizeEx", ret = Int, args = {}, call = NotImplemented)
990990
@CApiBuiltin(name = "Py_FrozenMain", ret = Int, args = {Int, CHAR_PTR_LIST}, call = NotImplemented)
991-
@CApiBuiltin(name = "Py_GETENV", ret = CHAR_PTR, args = {ConstCharPtrAsTruffleString}, call = NotImplemented)
991+
@CApiBuiltin(name = "Py_GETENV", ret = CHAR_PTR, args = {ConstCharPtrAsTruffleString}, call = CImpl)
992992
@CApiBuiltin(name = "Py_GetArgcArgv", ret = Void, args = {INT_LIST, WCHAR_T_PTR_PTR_LIST}, call = NotImplemented)
993993
@CApiBuiltin(name = "Py_GetCopyright", ret = ConstCharPtrAsTruffleString, args = {}, call = NotImplemented)
994994
@CApiBuiltin(name = "Py_GetExecPrefix", ret = WCHAR_T_PTR, args = {}, call = NotImplemented)

mx.graalpython/mx_graalpython_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0

0 commit comments

Comments
 (0)