Python binding: Avoid using globals in Base.__del__()
@martinweismann ci sta già lavorando.
Dal 23/2/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 54
- Fork
- 26
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Autodesk/AutomaticComponentToolkit
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
Autodesk/AutomaticComponentToolkit#213 · 1 commento · 2 reazioni ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
Autodesk/AutomaticComponentToolkit#188 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
Autodesk/AutomaticComponentToolkit#183 · 1 commento ·
-
stringoutclass issues Aperta
Autodesk/AutomaticComponentToolkit#162 · 1 reazione · 2 assegnatari ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Tutte le issue di Autodesk/AutomaticComponentToolkit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
acceptance-tests phase-coding schema-coverage testing triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100