Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deactivate _PyTraceback_Add #1697

Merged
merged 3 commits into from
Oct 13, 2024
Merged
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
34 changes: 15 additions & 19 deletions openage/cppinterface/exctranslate.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015-2023 the openage authors. See copying.md for legal info.
# Copyright 2015-2024 the openage authors. See copying.md for legal info.

"""
Provides the raise_py_exception and describe_py_exception callbacks for
Expand All @@ -10,21 +10,14 @@ from cpython.exc cimport (
PyErr_Occurred,
PyErr_Fetch,
PyErr_NormalizeException,
PyErr_SetObject,
PyErr_Restore
)
from cpython.pystate cimport (
PyThreadState,
PyThreadState_Get
PyErr_SetObject
)

from libcpp.string cimport string
from libcpp cimport bool as cppbool

from libopenage.log.level cimport level, err as lvl_err
from libopenage.log.message cimport message
from libopenage.error.error cimport Error
from libopenage.error.backtrace cimport Backtrace, backtrace_symbol
from libopenage.error.backtrace cimport backtrace_symbol
from libopenage.pyinterface.functional cimport Func1
from libopenage.pyinterface.pyexception cimport (
PyException,
Expand All @@ -36,26 +29,29 @@ from libopenage.pyinterface.exctranslate cimport (
set_exc_translation_funcs
)

import importlib
from ..testing.testing import TestError
from ..log import err, info
from ..log import info

cdef extern from "Python.h":
int PyException_SetTraceback(PyObject *ex, PyObject *tb)

cdef extern from "traceback.h":
void _PyTraceback_Add(const char *funcname, const char *filename, int lineno)
# _PyTraceback_Add has been made private in Python 3.13
# see https://github.com/python/cpython/pull/108453
# TODO: Find another solution to add tracebacks
# cdef extern from "traceback.h":
# void _PyTraceback_Add(const char *funcname, const char *filename, int lineno)


cdef void PyTraceback_Add(const char *functionname, const char *filename, int lineno) noexcept with gil:
"""
Add a new traceback stack frame.
Redirects to Python's internal _PyTraceback_Add function.
"""
# possible since 3.4.3 due to http://bugs.python.org/issue24436.
# the function will likely remain internal due to https://bugs.python.org/issue24743

_PyTraceback_Add(functionname, filename, lineno)
Note: Currently does nothing, because _PyTraceback_Add is no longer
accessible since Python 3.13.

TODO: Find another solution to add tracebacks.
"""
# _PyTraceback_Add(functionname, filename, lineno)


cdef class CPPMessageObject:
Expand Down
Loading