Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-integrations-web-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions scripts/populate_tox/tox.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ 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

# === 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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions sentry_sdk/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion sentry_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,8 @@ def safe_repr(value):
# type: (Any) -> str
try:
return repr(value)
except Exception:
except Exception as e:
print(e)
return "<broken repr>"
Comment on lines 541 to 545
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception is encountered locally but not in CI.



Expand Down
11 changes: 0 additions & 11 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
68 changes: 31 additions & 37 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,66 +751,60 @@ def test_cyclic_data(sentry_init, capture_events):
assert data == {"not_cyclic2": "", "not_cyclic": "", "is_cyclic": "<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()

value = ["a"]
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):
Expand Down
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ 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

# === 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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading