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

Support old versions of greenlet #432

Merged
merged 3 commits into from
Jul 29, 2023

Conversation

godlygeek
Copy link
Contributor

Closes #384

The latest versions of greenlet now support 3.11, though 3.12 is not yet
supported. Update our tests to exercise our greenlet handling on 3.11.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
@godlygeek godlygeek self-assigned this Jul 29, 2023
Prior to greenlet 1.0, the "greenlet" module wasn't a Python package
containing a private extension module, it was just a public extension
module. Handle this case by updating our hacky detection for greenlet
being imported after tracking has begun to recognize "greenlet.*.so" in
addition to "_greenlet.*.so", and update our trace hook injection to
fall back to `greenlet.settrace` if `greenlet._greenlet` hasn't been
imported but `greenlet` has.

Note that we can't unconditionally call `greenlet.set_trace`, because at
the point where our hooks are being installed, it's possible that the
`greenlet._greenlet` extension module has been imported but the
`greenlet/__init__.py` module doesn't yet have a `settrace` attribute
because it hasn't yet done `from ._greenlet import settrace`.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
These don't show up as lint errors since the scripts are given as string
literals, but when I copied these test programs out into standalone
scripts to try to investigate the greenlet 0.X issue, Black and flake8
caught these issues.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 40.00% and project coverage change: -0.03% ⚠️

Comparison is base (a519a95) 91.72% compared to head (6d37b38) 91.69%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #432      +/-   ##
==========================================
- Coverage   91.72%   91.69%   -0.03%     
==========================================
  Files          90       90              
  Lines       10503    10506       +3     
  Branches     1446     1446              
==========================================
  Hits         9634     9634              
- Misses        866      869       +3     
  Partials        3        3              
Flag Coverage Δ
cpp 85.11% <40.00%> (-0.08%) ⬇️
python_and_cython 95.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/memray/_memray/tracking_api.cpp 87.73% <0.00%> (-0.33%) ⬇️
tests/integration/test_greenlet.py 100.00% <ø> (ø)
src/memray/_memray/hooks.cpp 98.01% <100.00%> (+0.01%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pablogsal pablogsal merged commit 28b0bea into bloomberg:main Jul 29, 2023
33 checks passed
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.

segmentation fault when profiling processes using old versions of greenlet
3 participants