tortoise
tortoise-orm
BlogDocsChangelog

Fix AttributeError when using Nuitka-compiled models

#2053Merged
Comparing
shkey:fix-nuitka-compiled-model-attribute-error
(
97e1476
) with
develop
(
1d2400b
)
CodSpeed Performance Gauge
0%
Untouched
16

Benchmarks

Passed

test_expressions_count
tests/benchmarks/test_expressions.py
CodSpeed Performance Gauge
+1%
858.8 µs853.1 µs
test_filter_few_fields
tests/benchmarks/test_filter.py
CodSpeed Performance Gauge
0%
1.1 ms1.1 ms
test_get_few_fields
tests/benchmarks/test_get.py
CodSpeed Performance Gauge
0%
737.5 µs735.3 µs
test_get_many_fields
tests/benchmarks/test_get.py
CodSpeed Performance Gauge
0%
1.1 ms1.1 ms
test_update_many_fields_with_update
tests/benchmarks/test_update.py
CodSpeed Performance Gauge
0%
897.5 µs895.8 µs
test_update_few_fields_with_update
tests/benchmarks/test_update.py
CodSpeed Performance Gauge
0%
726.5 µs725.7 µs
test_filter_many_filters
tests/benchmarks/test_filter.py
CodSpeed Performance Gauge
0%
3.3 ms3.3 ms
test_expressions_f
tests/benchmarks/test_expressions.py
CodSpeed Performance Gauge
0%
754.1 µs754.5 µs
test_bulk_create_many_fields
tests/benchmarks/test_bulk_create.py
CodSpeed Performance Gauge
0%
10.7 ms10.7 ms
test_field_attribute_lookup_get_for_dialect
tests/benchmarks/test_field_attribute_lookup.py
CodSpeed Performance Gauge
0%
59 µs59.2 µs
test_update_few_fields_with_save
tests/benchmarks/test_update.py
CodSpeed Performance Gauge
0%
403.2 µs404.8 µs
test_create_many_fields
tests/benchmarks/test_create.py
CodSpeed Performance Gauge
0%
734.4 µs737.6 µs
test_create_few_fields
tests/benchmarks/test_create.py
CodSpeed Performance Gauge
0%
474.9 µs477 µs
test_bulk_create_few_fields
tests/benchmarks/test_bulk_create.py
CodSpeed Performance Gauge
-1%
2.5 ms2.5 ms
test_update_many_fields_with_save
tests/benchmarks/test_update.py
CodSpeed Performance Gauge
-1%
537.6 µs541.2 µs

Commits

Click on a commit to change the comparison range
Base
develop
1d2400b
-0.15%
Fix AttributeError when using Nuitka-compiled models When using tortoise-orm with Nuitka-compiled Python code, the _get_comments function fails with an AttributeError because inspect.getsourcefile() returns None for compiled modules, and the code attempts to call .endswith() on None. This error occurs in the following stack trace: - _get_comments() calls inspect.getsource(cls) - inspect.getsource() -> inspect.getsourcelines() -> inspect.findsource() - inspect.findsourcefile() returns None for Nuitka-compiled modules - inspect.findsource() tries to call filename.endswith(), causing AttributeError The fix adds AttributeError to the exception handling in _get_comments(), allowing the function to gracefully return an empty dict when source code cannot be retrieved from compiled modules. Fixes: AttributeError: 'NoneType' object has no attribute 'endswith'
6befd8c
4 days ago
by shkey
+0.07%
Add changelog entry and contributor credit - Added changelog entry for Nuitka compilation fix in 0.26.0 section - Added Qian Chen (@shkey) to contributors list
97e1476
3 days ago
by shkey
© 2026 CodSpeed Technology
Home Terms Privacy Docs