PY-60243 Fix tests broken after adding Python 3.12 to test environments

GitOrigin-RevId: e1848793807a3e9b34683dc40146b40506aa22e2
This commit is contained in:
Andrey Lisin
2023-05-02 21:54:13 +00:00
committed by intellij-monorepo-bot
parent cb2283193f
commit ef695b4e4f
4 changed files with 11 additions and 5 deletions
@@ -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:
@@ -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
@@ -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:
@@ -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();
}