FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Preliminary support for Python 3.13 by sentrivana · Pull Request #3200 · getsentry/sentry-python · GitHub

feat: Preliminary support for Python 3.13 - #3200

Merged
sentrivana merged 10 commits into
masterfrom
ivana/python-3.13
Jul 16, 2024
Merged

feat: Preliminary support for Python 3.13#3200
sentrivana merged 10 commits into
masterfrom
ivana/python-3.13

Conversation

sentrivana commented Jun 25, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

No RC yet, just beta releases, but we can already start setting stuff up.

3.13 release schedule: https://peps.python.org/pep-0719/#schedule

sentrivana changed the title Test against Python 3.13 tests: Test against Python 3.13 Jun 25, 2024
rominf added 2 commits July 16, 2024 15:22
…on 3.13) (#3272)

The `_partialmethod` attribute of methods wrapped with `partialmethod()`
was renamed to `__partialmethod__` in CPython 3.13:
python/cpython#16600
…3271)

Starting from Python 3.13, `frame.f_locals` is not `dict` anymore, but
`FrameLocalsProxy`, that cannot be copied using `copy.copy()`. In Python
3.13 and later, it should be copied using a method `.copy()`. The new way
of copying works the same as the old one for versions of Python prior to
3.13, according to the documentation (both copying methods produce a
shallow copy).

Since Python 3.13, `FrameLocalsProxy` skips items of `locals()` that have
non-`str` keys; this is a CPython implementation detail, so we hence
disable `test_non_string_variables` test on Python 3.13.

See:
https://peps.python.org/pep-0667/
python/cpython#118921
python/cpython#118923
https://docs.python.org/3.13/whatsnew/3.13.html#porting-to-python-3-13
https://docs.python.org/3/library/copy.html
https://github.com/python/cpython/blame/7b413952e817ae87bfda2ac85dd84d30a6ce743b/Objects/frameobject.c#L148
sentrivana linked an issue Jul 16, 2024 that may be closed by this pull request
sentrivana changed the title tests: Test against Python 3.13 feat: Support Python 3.13 Jul 16, 2024
sentrivana changed the title feat: Support Python 3.13 feat: Preliminary support for Python 3.13 Jul 16, 2024
sentrivana marked this pull request as ready for review July 16, 2024 13:41

szokeasaurusrex left a comment
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Do these allow-prereleases: true have any affect on non-3.13 tests? I would be hesitant to merge this if so

Edit: Just noticed the "Do not merge" label, is that still accurate?

antonpirker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

🔥

Comment thread sentry_sdk/utils.py

if include_local_variables:
rv["vars"] = copy(frame.f_locals)
rv["vars"] = frame.f_locals.copy()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

why this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This commit has the details.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

^ Basically, frame.f_locals is no longer a dict in 3.13

Copy link
Copy Markdown
Contributor Author

Do these allow-prereleases: true have any affect on non-3.13 tests? I would be hesitant to merge this if so

Will double check this.

Edit: Just noticed the "Do not merge" label, is that still accurate?

No, removed now, thanks for noticing!

codecov Bot commented Jul 16, 2024
edited
Loading

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.46%. Comparing base (cf8e37f) to head (e2eb799).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3200      +/-   ##
==========================================
+ Coverage   79.45%   79.46%   +0.01%     
==========================================
  Files         133      133              
  Lines       14290    14290              
  Branches     3004     3004              
==========================================
+ Hits        11354    11356       +2     
+ Misses       2091     2089       -2     
  Partials      845      845              
Files Coverage Δ
sentry_sdk/utils.py 82.64% <100.00%> (+0.37%) ⬆️

... and 1 file with indirect coverage changes

Copy link
Copy Markdown
Contributor Author

@szokeasaurusrex allow-prereleases will only kick in if the specified Python version is not generally available (all older Python versions are, so no effect there), see here.

szokeasaurusrex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nice!

sentrivana merged commit a98f660 into master Jul 16, 2024
sentrivana deleted the ivana/python-3.13 branch July 16, 2024 14:10
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this pull request Sep 30, 2024
Adding preliminary support for Python 3.13.

The `_partialmethod` attribute of methods wrapped with `partialmethod()`
was renamed to `__partialmethod__` in CPython 3.13:
python/cpython#16600

Starting from Python 3.13, `frame.f_locals` is not `dict` anymore, but
`FrameLocalsProxy`, that cannot be copied using `copy.copy()`. In Python
3.13 and later, it should be copied using a method `.copy()`. The new way
of copying works the same as the old one for versions of Python prior to
3.13, according to the documentation (both copying methods produce a
shallow copy).

Since Python 3.13, `FrameLocalsProxy` skips items of `locals()` that have
non-`str` keys; this is a CPython implementation detail, so we hence
disable `test_non_string_variables` test on Python 3.13.

See:
https://peps.python.org/pep-0667/
python/cpython#118921
python/cpython#118923
https://docs.python.org/3.13/whatsnew/3.13.html#porting-to-python-3-13
https://docs.python.org/3/library/copy.html
https://github.com/python/cpython/blame/7b413952e817ae87bfda2ac85dd84d30a6ce743b/Objects/frameobject.c#L148

---------

Co-authored-by: Roman Inflianskas <rominf@pm.me>
turicas added a commit to turicas/sentry-python that referenced this pull request Jun 6, 2025
Partial cherry-pick of: a98f660

Adding preliminary support for Python 3.13.

The `_partialmethod` attribute of methods wrapped with `partialmethod()`
was renamed to `__partialmethod__` in CPython 3.13:
python/cpython#16600

Starting from Python 3.13, `frame.f_locals` is not `dict` anymore, but
`FrameLocalsProxy`, that cannot be copied using `copy.copy()`. In Python
3.13 and later, it should be copied using a method `.copy()`. The new way
of copying works the same as the old one for versions of Python prior to
3.13, according to the documentation (both copying methods produce a
shallow copy).

Since Python 3.13, `FrameLocalsProxy` skips items of `locals()` that have
non-`str` keys; this is a CPython implementation detail, so we hence
disable `test_non_string_variables` test on Python 3.13.

See:
https://peps.python.org/pep-0667/
python/cpython#118921
python/cpython#118923
https://docs.python.org/3.13/whatsnew/3.13.html#porting-to-python-3-13
https://docs.python.org/3/library/copy.html
https://github.com/python/cpython/blame/7b413952e817ae87bfda2ac85dd84d30a6ce743b/Objects/frameobject.c#L148
turicas added a commit to turicas/sentry-python that referenced this pull request Jun 6, 2025
Partial cherry-pick of: a98f660

Adding preliminary support for Python 3.13.

The `_partialmethod` attribute of methods wrapped with `partialmethod()`
was renamed to `__partialmethod__` in CPython 3.13:
python/cpython#16600

Starting from Python 3.13, `frame.f_locals` is not `dict` anymore, but
`FrameLocalsProxy`, that cannot be copied using `copy.copy()`. In Python
3.13 and later, it should be copied using a method `.copy()`. The new way
of copying works the same as the old one for versions of Python prior to
3.13, according to the documentation (both copying methods produce a
shallow copy).

Since Python 3.13, `FrameLocalsProxy` skips items of `locals()` that have
non-`str` keys; this is a CPython implementation detail, so we hence
disable `test_non_string_variables` test on Python 3.13.

See:
https://peps.python.org/pep-0667/
python/cpython#118921
python/cpython#118923
https://docs.python.org/3.13/whatsnew/3.13.html#porting-to-python-3-13
https://docs.python.org/3/library/copy.html
https://github.com/python/cpython/blame/7b413952e817ae87bfda2ac85dd84d30a6ce743b/Objects/frameobject.c#L148
turicas added a commit to turicas/sentry-python that referenced this pull request Jun 6, 2025
Partial cherry-pick of: a98f660

Adding preliminary support for Python 3.13.

The `_partialmethod` attribute of methods wrapped with `partialmethod()`
was renamed to `__partialmethod__` in CPython 3.13:
python/cpython#16600

Starting from Python 3.13, `frame.f_locals` is not `dict` anymore, but
`FrameLocalsProxy`, that cannot be copied using `copy.copy()`. In Python
3.13 and later, it should be copied using a method `.copy()`. The new way
of copying works the same as the old one for versions of Python prior to
3.13, according to the documentation (both copying methods produce a
shallow copy).

Since Python 3.13, `FrameLocalsProxy` skips items of `locals()` that have
non-`str` keys; this is a CPython implementation detail, so we hence
disable `test_non_string_variables` test on Python 3.13.

See:
https://peps.python.org/pep-0667/
python/cpython#118921
python/cpython#118923
https://docs.python.org/3.13/whatsnew/3.13.html#porting-to-python-3-13
https://docs.python.org/3/library/copy.html
https://github.com/python/cpython/blame/7b413952e817ae87bfda2ac85dd84d30a6ce743b/Objects/frameobject.c#L148
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Python 3.13 (coming Oct 2024)

4 participants


Back | FazBrowse Home | New Git URL