Skip to content

"TypeError: 'NoneType' object is not callable" during calls to wasmtime.Managed.__del__ #302

@moreati

Description

@moreati

One or more exceptions occur during Python interpreter shutdown, after the loader_component.py example is executed in an interactive session (REPL).

Steps to reproduce

  1. Star a Python REPL
  2. Paste the contents of https://github.com/bytecodealliance/wasmtime-py/blob/main/examples/loader_component.py
  3. Exit the REPL

Result:

Python 3.14.0 (main, Oct 14 2025, 21:10:22) [Clang 20.1.4 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wasmtime, wasmtime.loader
... 
... import loader_component_add  # type: ignore
... 
... 
... store = wasmtime.Store()
... component = loader_component_add.Root(store)
... assert component.add(store, 1, 2) == 3
... 
>>> 
Exception ignored while calling deallocator <function Managed.__del__ at 0x102961170>:
Traceback (most recent call last):
  File "/Users/alex/src/wasmtime-py/.venv/lib/python3.14/site-packages/wasmtime/_managed.py", line 95, in __del__
  File "/Users/alex/src/wasmtime-py/.venv/lib/python3.14/site-packages/wasmtime/_managed.py", line 44, in close
  File "/Users/alex/src/wasmtime-py/.venv/lib/python3.14/site-packages/wasmtime/_store.py", line 31, in _delete
TypeError: 'NoneType' object is not callable
Exception ignored while calling deallocator <function Managed.__del__ at 0x102961170>:
Traceback (most recent call last):
  File "/Users/alex/src/wasmtime-py/.venv/lib/python3.14/site-packages/wasmtime/_managed.py", line 95, in __del__
  File "/Users/alex/src/wasmtime-py/.venv/lib/python3.14/site-packages/wasmtime/_managed.py", line 44, in close
  File "/Users/alex/src/wasmtime-py/.venv/lib/python3.14/site-packages/wasmtime/_engine.py", line 19, in _delete
TypeError: 'NoneType' object is not callable

The exception does not occur when the example is run as a script

(wasmtime-py) ➜  examples git:(nox) ✗ python loader_component.py 
(wasmtime-py) ➜  examples git:(nox) ✗ echo $?   
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions