diff --git a/.github/workflows/test-integrations-common.yml b/.github/workflows/test-integrations-common.yml index eb5dde8b17..7d4a9a9566 100644 --- a/.github/workflows/test-integrations-common.yml +++ b/.github/workflows/test-integrations-common.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13"] + python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14"] # python3.6 reached EOL and is no longer being supported on # new versions of hosted runners on Github Actions # ubuntu-20.04 is the last version that supported python3.6 diff --git a/.github/workflows/test-integrations-misc.yml b/.github/workflows/test-integrations-misc.yml index 2aaf2f07fe..365f0f47bc 100644 --- a/.github/workflows/test-integrations-misc.yml +++ b/.github/workflows/test-integrations-misc.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13"] + python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14"] # python3.6 reached EOL and is no longer being supported on # new versions of hosted runners on Github Actions # ubuntu-20.04 is the last version that supported python3.6 diff --git a/.github/workflows/test-integrations-web-2.yml b/.github/workflows/test-integrations-web-2.yml index 98cf4456e8..699915c387 100644 --- a/.github/workflows/test-integrations-web-2.yml +++ b/.github/workflows/test-integrations-web-2.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13"] + python-version: ["3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14"] # python3.6 reached EOL and is no longer being supported on # new versions of hosted runners on Github Actions # ubuntu-20.04 is the last version that supported python3.6 diff --git a/scripts/populate_tox/tox.jinja b/scripts/populate_tox/tox.jinja index b86da57c24..ccf4c0e98b 100755 --- a/scripts/populate_tox/tox.jinja +++ b/scripts/populate_tox/tox.jinja @@ -18,7 +18,7 @@ requires = virtualenv<20.26.3 envlist = # === Common === - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common + {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14}-common # === Gevent === {py3.6,py3.8,py3.10,py3.11,py3.12}-gevent @@ -26,7 +26,7 @@ envlist = # === Integrations === # Asgi - {py3.7,py3.12,py3.13}-asgi + {py3.7,py3.12,py3.13,py3.14}-asgi # AWS Lambda {py3.8,py3.9,py3.11,py3.13}-aws_lambda @@ -38,7 +38,7 @@ envlist = {py3.7}-gcp # OpenTelemetry (OTel) - {py3.7,py3.9,py3.12,py3.13}-opentelemetry + {py3.7,py3.9,py3.12,py3.13,py3.14}-opentelemetry # OpenTelemetry Experimental (POTel) {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-potel @@ -74,7 +74,7 @@ deps = # and https://github.com/pytest-dev/pytest-forked/issues/67 # for justification of the upper bound on pytest {py3.6,py3.7}-common: pytest<7.0.0 - {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common: pytest + {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14}-common: pytest # === Gevent === {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-gevent: gevent>=22.10.0, <22.11.0 @@ -177,6 +177,7 @@ basepython = py3.11: python3.11 py3.12: python3.12 py3.13: python3.13 + py3.14: python3.14 # Python version is pinned here for consistency across environments. # Tools like ruff and mypy have options that pin the target Python diff --git a/sentry_sdk/serializer.py b/sentry_sdk/serializer.py index 1775b1b555..eb53259cea 100644 --- a/sentry_sdk/serializer.py +++ b/sentry_sdk/serializer.py @@ -146,11 +146,7 @@ def _safe_repr_wrapper(value): def _annotate(**meta): # type: (**Any) -> None while len(meta_stack) <= len(path): - try: - segment = path[len(meta_stack) - 1] - node = meta_stack[-1].setdefault(str(segment), {}) - except IndexError: - node = {} + node = {} meta_stack.append(node) diff --git a/sentry_sdk/utils.py b/sentry_sdk/utils.py index cd825b29e2..1039808c4f 100644 --- a/sentry_sdk/utils.py +++ b/sentry_sdk/utils.py @@ -540,7 +540,8 @@ def safe_repr(value): # type: (Any) -> str try: return repr(value) - except Exception: + except Exception as e: + print(e) return "" diff --git a/tests/conftest.py b/tests/conftest.py index faa0251d9b..ebb4bba95f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -57,17 +57,6 @@ with open(SENTRY_EVENT_SCHEMA) as f: SENTRY_EVENT_SCHEMA = json.load(f) -try: - import pytest_benchmark -except ImportError: - - @pytest.fixture - def benchmark(): - return lambda x: x() - -else: - del pytest_benchmark - from sentry_sdk import scope diff --git a/tests/test_client.py b/tests/test_client.py index ff3f61d702..996fe032b6 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -751,7 +751,7 @@ def test_cyclic_data(sentry_init, capture_events): assert data == {"not_cyclic2": "", "not_cyclic": "", "is_cyclic": ""} -def test_databag_depth_stripping(sentry_init, capture_events, benchmark): +def test_databag_depth_stripping(sentry_init, capture_events): sentry_init() events = capture_events() @@ -759,58 +759,52 @@ def test_databag_depth_stripping(sentry_init, capture_events, benchmark): for _ in range(100000): value = [value] - @benchmark - def inner(): - del events[:] - try: - a = value # noqa - 1 / 0 - except Exception: - capture_exception() + del events[:] + try: + a = value # noqa + 1 / 0 + except Exception: + capture_exception() - (event,) = events + (event,) = events - assert len(json.dumps(event)) < 10000 + assert len(json.dumps(event)) < 10000 -def test_databag_string_stripping(sentry_init, capture_events, benchmark): +def test_databag_string_stripping(sentry_init, capture_events): sentry_init() events = capture_events() - @benchmark - def inner(): - del events[:] - try: - a = "A" * DEFAULT_MAX_VALUE_LENGTH * 10 # noqa - 1 / 0 - except Exception: - capture_exception() + del events[:] + try: + a = "A" * DEFAULT_MAX_VALUE_LENGTH * 10 # noqa + 1 / 0 + except Exception: + capture_exception() - (event,) = events + (event,) = events - assert len(json.dumps(event)) < DEFAULT_MAX_VALUE_LENGTH * 10 + assert len(json.dumps(event)) < DEFAULT_MAX_VALUE_LENGTH * 10 -def test_databag_breadth_stripping(sentry_init, capture_events, benchmark): +def test_databag_breadth_stripping(sentry_init, capture_events): sentry_init() events = capture_events() - @benchmark - def inner(): - del events[:] - try: - a = ["a"] * 1000000 # noqa - 1 / 0 - except Exception: - capture_exception() + del events[:] + try: + a = ["a"] * 1000000 # noqa + 1 / 0 + except Exception: + capture_exception() - (event,) = events + (event,) = events - assert ( - len(event["exception"]["values"][0]["stacktrace"]["frames"][0]["vars"]["a"]) - == MAX_DATABAG_BREADTH - ) - assert len(json.dumps(event)) < 10000 + assert ( + len(event["exception"]["values"][0]["stacktrace"]["frames"][0]["vars"]["a"]) + == MAX_DATABAG_BREADTH + ) + assert len(json.dumps(event)) < 10000 def test_chained_exceptions(sentry_init, capture_events): diff --git a/tox.ini b/tox.ini index 668e5888b4..85f7b5bf63 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ requires = virtualenv<20.26.3 envlist = # === Common === - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common + {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14}-common # === Gevent === {py3.6,py3.8,py3.10,py3.11,py3.12}-gevent @@ -26,7 +26,7 @@ envlist = # === Integrations === # Asgi - {py3.7,py3.12,py3.13}-asgi + {py3.7,py3.12,py3.13,py3.14}-asgi # AWS Lambda {py3.8,py3.9,py3.11,py3.13}-aws_lambda @@ -38,7 +38,7 @@ envlist = {py3.7}-gcp # OpenTelemetry (OTel) - {py3.7,py3.9,py3.12,py3.13}-opentelemetry + {py3.7,py3.9,py3.12,py3.13,py3.14}-opentelemetry # OpenTelemetry Experimental (POTel) {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-potel @@ -303,7 +303,7 @@ deps = # and https://github.com/pytest-dev/pytest-forked/issues/67 # for justification of the upper bound on pytest {py3.6,py3.7}-common: pytest<7.0.0 - {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common: pytest + {py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14}-common: pytest # === Gevent === {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11}-gevent: gevent>=22.10.0, <22.11.0 @@ -822,6 +822,7 @@ basepython = py3.11: python3.11 py3.12: python3.12 py3.13: python3.13 + py3.14: python3.14 # Python version is pinned here for consistency across environments. # Tools like ruff and mypy have options that pin the target Python