Skip to content

Refactor congruence checks based on assert at runtime#932

Merged
itamarst merged 1 commit intoeventlet:masterfrom
4383:remove-asserts
Mar 13, 2024
Merged

Refactor congruence checks based on assert at runtime#932
itamarst merged 1 commit intoeventlet:masterfrom
4383:remove-asserts

Conversation

@4383
Copy link
Copy Markdown
Member

@4383 4383 commented Mar 12, 2024

assert statements are completely eliminated when the python interpreter is ran with the optimization flags [1].

Those checks are not an option and should be executed not matter the execution context.

This patch refactor those checks to not rely anymore on the assert statement.

This patch is mainly focused on hub checks. Other assert statements are still present, I'll refactor them later.

Refactoring this kind of code ensure to not waste time managing issues and debugging bugs related to the optimization features of the interpreter.

[1] https://docs.python.org/3/using/cmdline.html#cmdoption-O

Assert statements are completely eliminated when the
python interpreter is ran with the optimization flags [1].

Those checks are not an option and should be executed
not matter the execution context.

This patch refactor those checks to not rely anymore
on the assert statement.

This patch is mainly focused on hub checks. Other
assert statements are still present, I'll refactor
them later.

Refactoring this kind of code ensure to not waste
time managing issues and debugging bugs related to
the optimization features of the interpreter.

[1] https://docs.python.org/3/using/cmdline.html#cmdoption-O
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 10.00000% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 56%. Comparing base (1f3db00) to head (5333544).

Files Patch % Lines
eventlet/hubs/__init__.py 16% 2 Missing and 3 partials ⚠️
eventlet/green/select.py 0% 1 Missing and 1 partial ⚠️
eventlet/greenthread.py 0% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##           master   #932   +/-   ##
=====================================
- Coverage      56%    56%   -1%     
=====================================
  Files          89     89           
  Lines        9748   9753    +5     
  Branches     1812   1817    +5     
=====================================
- Hits         5471   5466    -5     
- Misses       3905   3909    +4     
- Partials      372    378    +6     
Flag Coverage Δ
ipv6 23% <0%> (-1%) ⬇️
py310asyncio 52% <10%> (-1%) ⬇️
py310epolls 53% <0%> (-1%) ⬇️
py310poll 53% <0%> (-1%) ⬇️
py310selects 53% <0%> (-1%) ⬇️
py311asyncio 52% <10%> (-1%) ⬇️
py311epolls 53% <0%> (-1%) ⬇️
py312asyncio 50% <10%> (-1%) ⬇️
py312epolls 51% <0%> (-1%) ⬇️
py37asyncio 50% <10%> (-1%) ⬇️
py37epolls 51% <0%> (-1%) ⬇️
py38asyncio 51% <10%> (-1%) ⬇️
py38epolls 53% <0%> (-1%) ⬇️
py38openssl 51% <0%> (-1%) ⬇️
py38poll 53% <0%> (-1%) ⬇️
py38selects 53% <0%> (-1%) ⬇️
py39asyncio 51% <10%> (-1%) ⬇️
py39dnspython1 51% <0%> (-1%) ⬇️
py39epolls 53% <0%> (-1%) ⬇️
py39poll 53% <0%> (-1%) ⬇️
py39selects 53% <0%> (-1%) ⬇️

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

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

@4383 4383 requested a review from itamarst March 12, 2024 18:24
@itamarst itamarst merged commit 48c259c into eventlet:master Mar 13, 2024
@4383 4383 mentioned this pull request Mar 15, 2024
clrpackages pushed a commit to clearlinux-pkgs/pypi-eventlet that referenced this pull request Jul 10, 2024
…rsion 0.36.1

0.36.1
======

* [fix] eventlet.websocket is not always used from eventlet.wsgi, so do not assume eventlet.set_idle exists eventlet/eventlet#949

0.36.0
======

* [fix] Make sure asyncio hub doesn't use greendns for asyncio DNS APIs eventlet/eventlet#938
* [fix] Make asyncio.to_thread work with the same semantics as normal asyncio eventlet/eventlet#930
* [fix] Refactor congruence checks based on assert at runtime eventlet/eventlet#932
* [tests] Run tests on macOS in CI, and some fixes to get it in reasonable state (#list eventlet/eventlet#934
* [fix] Fix wsgi.server shutdown for in-flight requests eventlet/eventlet#912
* [feature] Add debug convenience helpers - asyncio, threads eventlet/eventlet#925
* [fix] Handle errors better. eventlet/eventlet#923

(NEWS truncated at 15 lines)

CVEs fixed in this build:
CVE-2023-29483
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