diff --git a/python/helpers/pydev/_pydev_bundle/_pydev_calltip_util.py b/python/helpers/pydev/_pydev_bundle/_pydev_calltip_util.py index 63285c228e55..2c427ed2d3b0 100644 --- a/python/helpers/pydev/_pydev_bundle/_pydev_calltip_util.py +++ b/python/helpers/pydev/_pydev_bundle/_pydev_calltip_util.py @@ -5,7 +5,7 @@ Author: Yuli Fitterman # noinspection PyBroadException import types -from _pydevd_bundle.pydevd_constants import IS_JYTHON, IS_PY3K, IS_PY311 +from _pydevd_bundle.pydevd_constants import IS_JYTHON, IS_PY3K, IS_PY311_OR_GREATER try: import inspect @@ -101,7 +101,7 @@ def get_description(obj): fn_class = None if callable(fob): try: - if IS_PY311: + if IS_PY311_OR_GREATER: spec_info = inspect.signature(fob) argspec = str(spec_info) else: diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_collect_try_except_info.py b/python/helpers/pydev/_pydevd_bundle/pydevd_collect_try_except_info.py index 64d3a9fc07ca..b9507b88a9e0 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_collect_try_except_info.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_collect_try_except_info.py @@ -9,7 +9,7 @@ try: except NameError: xrange = range -from _pydevd_bundle.pydevd_constants import IS_PY38_OR_GREATER +from _pydevd_bundle.pydevd_constants import IS_PY38_OR_GREATER, IS_PY312_OR_GREATER class TryExceptInfo(object): @@ -145,6 +145,10 @@ def _iter_instructions(co): yield instruction +_return_op_names = {'RETURN_VALUE', 'RETURN_CONST'} if IS_PY312_OR_GREATER \ + else {'RETURN_VALUE'} + + def collect_return_info(co, use_func_first_line=False): if not hasattr(co, 'co_lnotab'): return [] @@ -158,7 +162,7 @@ def collect_return_info(co, use_func_first_line=False): op_offset_to_line = dict(dis.findlinestarts(co)) for instruction in _iter_instructions(co): curr_op_name = instruction.opname - if curr_op_name == 'RETURN_VALUE': + if curr_op_name in _return_op_names: lst.append(ReturnInfo(_get_line(op_offset_to_line, instruction.offset, firstlineno, search=True))) return lst diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_constants.py b/python/helpers/pydev/_pydevd_bundle/pydevd_constants.py index 0e91d042c3a4..b5d01a6443cf 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_constants.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_constants.py @@ -128,6 +128,7 @@ IS_PY38 = False IS_PY39_OR_GREATER = False IS_PY311 = False IS_PY311_OR_GREATER = False +IS_PY312_OR_GREATER = False IS_PY2 = True IS_PY27 = False IS_PY24 = False @@ -144,6 +145,7 @@ try: IS_PY39_OR_GREATER = sys.version_info >= (3, 9) IS_PY311 = sys.version_info[0] == 3 and sys.version_info[1] == 11 IS_PY311_OR_GREATER = sys.version_info >= (3, 11) + IS_PY312_OR_GREATER = sys.version_info >= (3, 12) elif sys.version_info[0] == 2 and sys.version_info[1] == 7: IS_PY27 = True elif sys.version_info[0] == 2 and sys.version_info[1] == 4: diff --git a/python/testSrc/com/jetbrains/env/debug/PythonDebuggerSteppingTest.java b/python/testSrc/com/jetbrains/env/debug/PythonDebuggerSteppingTest.java index d348764b2331..3104cf633a43 100644 --- a/python/testSrc/com/jetbrains/env/debug/PythonDebuggerSteppingTest.java +++ b/python/testSrc/com/jetbrains/env/debug/PythonDebuggerSteppingTest.java @@ -1057,7 +1057,7 @@ public class PythonDebuggerSteppingTest extends PyEnvTestCase { eval("result").hasValue("3"); stepOver(); waitForPause(); - eval("z").hasValue("42"); // check that we haven't got into the `asyncio` machinery + eval("z").hasValue("42"); // Check that we haven't fallen into the `asyncio` machinery. resume(); waitForTerminate(); }