From 68c37ce9868a94311966467e0651529ab4b161be Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Wed, 20 Sep 2023 08:28:12 +0200 Subject: [PATCH] Python: Getting Started enhanced locals (#7862) * Python: Getting Started enhanced locals * style(lint): Auto commit lint changes --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com> --- .../configuration/integrations/pure_eval.mdx | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/platforms/python/common/configuration/integrations/pure_eval.mdx b/src/platforms/python/common/configuration/integrations/pure_eval.mdx index dbc8ea5cd0d27..416a5300da873 100644 --- a/src/platforms/python/common/configuration/integrations/pure_eval.mdx +++ b/src/platforms/python/common/configuration/integrations/pure_eval.mdx @@ -4,16 +4,8 @@ description: "Learn about `pure_eval` and how to add it to your integrations lis sidebar_order: 40 --- - - This integration uses [`pure_eval`](https://github.com/alexmojaki/pure_eval) to safely evaluate additional expressions in the source code and display their values alongside other local variables. - - -**This integration is experimental.** It may be removed in minor versions. - - - ## Install Install `sentry-sdk` from PyPI with the `pure_eval` extra or `pip install pure_eval executing asttokens`. @@ -40,6 +32,23 @@ sentry_sdk.init( ) ``` +## Verify + +```python +from types import SimpleNamespace + +def main(): + sentry_sdk.init(...) # same as above + + namespace = SimpleNamespace() + namespace.d = {1: 2} + print(namespace.d[1] / 0) + +main() +``` + +When you run this example script an error will be sent to Sentry. Through the `PureEvalIntegration` the stack trace of the error will include the values of `namespace.d` and `namespace.d[1]` which would not be shown without `PureEvalIntegration`. + ## Supported Versions - Python: 3.5+