Python binding: Avoid using globals in Base.__del__()
@martinweismann đang làm issue này rồi.
Từ ngày 23/2/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Running 'build123d' examples I saw errors like
Exception ignored in: <function _Base.__del__ at 0x123e68180>
Traceback (most recent call last):
File "venv/lib/python3.13/site-packages/lib3mf/Lib3MF.py", line 57, in __del__
File "venv/lib/python3.13/site-packages/lib3mf/Lib3MF.py", line 6832, in Release
File "venv/lib/python3.13/site-packages/lib3mf/Lib3MF.py", line 6767, in checkError
AttributeError: 'NoneType' object has no attribute 'SUCCESS'
This is error from the "lib3mf" package, and the by "AutomaticComponentToolkit" generated file lib3mf/Autogenerated/Bindings/Python/Lib3MF.py.
This file has been generated by the Automatic Component Toolkit (ACT) version 1.8.0-alpha.
This seems to happen in some situations when the Python script terminates. The error message is most likely harmless, but it is confusing as a user to see this error message and not knowing if things went ok or not.
Looking at the code, the class Base __del__() method calls _wrapper.Release() that calls checkError(). The problem seems to be that when Python cleans up, it might remove the class ErrorCodes before it try remove the class Base, i.e. ErrorCodes is no longer defined. This is likely what gives the error above. This problem is documented at
https://docs.python.org/3.9/reference/datamodel.html#object.__del__
Could the solution be to change the __del__() call to an __exit__() call ? It makes the error message go away but I don't know if it is the right thing to do.
As this happens when terminating, another solution might be to replace the line
if errorCode != ErrorCodes.SUCCESS.value:
with
if ErrorCodes and errorCode != ErrorCodes.SUCCESS.value:
This feels more like a hack and I haven't tested this.
- Ngôn ngữ chính
- Go
- Star
- 54
- Fork
- 26
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Autodesk/AutomaticComponentToolkit
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
Autodesk/AutomaticComponentToolkit#213 · 1 bình luận · 2 reaction ·
-
XML namespaces are not observed Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Autodesk/AutomaticComponentToolkit#188 · 1 bình luận ·
-
Why isn't JNI already a target? Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
Autodesk/AutomaticComponentToolkit#183 · 1 bình luận ·
-
stringoutclass issues Đang mở
Autodesk/AutomaticComponentToolkit#162 · 1 reaction · 2 người được giao ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của Autodesk/AutomaticComponentToolkit
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 60/100
github/gh-aw-mcpg#13748 ·
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
googleapis/librarian#7670 · 2 bình luận ·