Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed support for Python 2 for upcoming v1.0.0 #435

Merged
merged 5 commits into from
Aug 23, 2023

Conversation

danielmorell
Copy link
Collaborator

Description of the change

This PR removes support for Python 2. Python 2 support is being removed in v1.0.0, and so this commit also bumps the version to v1.0.0beta0.

Doing this allowed a bunch of code to be simplified. This reduced function calls, memory allocations, generally increased performance. Some early benchmarks showed that the call stack data collection sanitization and serialization is 18.7% faster than previously.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Related issues

None

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers assigned
  • Issue from task tracker has a link to this pull request
  • Changes have been reviewed by at least one other engineer

@danielmorell danielmorell added this to the v1.0.0 milestone Aug 18, 2023
@danielmorell danielmorell requested a review from alif August 18, 2023 19:49
@danielmorell danielmorell self-assigned this Aug 18, 2023
@danielmorell
Copy link
Collaborator Author

The reason for e054667 is the immutables library switched from Py_TRASHCAN_SAFE_BEGIN/END to Py_TRASHCAN_BEGIN/END in v0.20. However these were not added to the CPython C API until Python v3.8 python/cpython@351c674.

The reason for bfaab77 is a KeyError was being thrown by importlib during a test run build (3.10, FASTAPI_VERSION=0.50.0 httpx==0.18.1 python-multipart==0.0.5).

======================================================================
ERROR: test_should_use_async_report_exc_info_if_any_async_handler (rollbar.test.fastapi_tests.test_middleware.ReporterMiddlewareTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/pyrollbar/pyrollbar/rollbar/test/fastapi_tests/test_middleware.py", line 30, in setUp
    importlib.reload(rollbar)
  File "/opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/importlib/__init__.py", line 169, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 619, in _exec
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/runner/work/pyrollbar/pyrollbar/rollbar/__init__.py", line 83, in <module>
    from google.appengine.api.urlfetch import fetch as AppEngineFetch
  File "<frozen importlib._bootstrap>", line 1024, in _find_and_load
  File "<frozen importlib._bootstrap>", line 171, in __enter__
  File "<frozen importlib._bootstrap>", line 123, in acquire
KeyError: 1[406](https://github.com/rollbar/pyrollbar/actions/runs/5907121447/job/16024697120#step:13:407)63925147456

----------------------------------------------------------------------
Ran 282 tests in 0.970s

FAILED (errors=1, skipped=7)
Test failed: <unittest.runner.TextTestResult run=282 errors=1 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=282 errors=1 failures=0>
Error: Process completed with exit code 1.

Copy link
Contributor

@waltjones waltjones left a comment

Choose a reason for hiding this comment

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

👍 Nice cleanup.

@danielmorell danielmorell merged commit 960b5cf into master Aug 23, 2023
85 checks passed
@danielmorell danielmorell deleted the removed/legacy-python-2-code branch August 23, 2023 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants