Tkinter deallocation warnings after plotting tests

Aperta
#141 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
matplotlib, python

Direzione di ricerca

Start with the three named tests in tests/integration/test_contour_plot_examples.py and reproduce the warnings in the stated Python 3.14, pytest and matplotlib environment. Trace how those tests create and clean up figures and Tkinter objects, then check whether cleanup occurs outside the GUI event loop. Done means the deallocation warnings are resolved and the integration tests pass; the issue does not identify a fix or more specific files to inspect.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

code hygiene infrastructure plotting

Warnings are emitted during the integration test suite when Tkinter objects are finalised:

PytestUnraisableExceptionWarning:
Exception ignored while calling deallocator
<function Variable.__del__ ...>

RuntimeError: main thread is not in main loop

The same error also occurs in tkinter.Image.__del__, where Tkinter attempts to delete an image from the Tcl/Tk interpreter.

The warnings have been observed in association with the following tests:

  • test_example_29_global_average_annual_temperature
  • test_example_7_lat_pressure_zonal_mean
  • test_example_10_latitude_time_hovmuller

emerging there in practice as:

tests/integration/test_contour_plot_examples.py::test_example_10_latitude_time_hovmuller
  /home/slb93/miniconda3/envs/cfplot-test-env/lib/python3.14/site-packages/_pytest/unraisableexception.py:67: PytestUnraisableExceptionWarning: Exception ignored while calling deallocator <function Image.__del__ at 0x7f6ee9513530>: None
  
  Traceback (most recent call last):
    File "/home/slb93/miniconda3/envs/cfplot-test-env/lib/python3.14/tkinter/__init__.py", line 4332, in __del__
      self.tk.call('image', 'delete', self.name)
      ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  RuntimeError: main thread is not in main loop
  
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

The warnings appear to arise during GUI-object cleanup rather than directly from the plotting operations. The available traceback does not yet establish whether figures or Tkinter objects are being retained beyond the lifetime of the GUI event loop, or whether this is a Matplotlib/Tkinter backend cleanup issue.

Environment

  • Python: 3.14
  • Test framework: pytest
  • Plotting library: matplotlib
  • GUI library involved in traceback: Tkinter
  • Environment: cfplot-test-env
Lingua principale
Python
Stelle
21
Fork
11
Merge medio
3g 8h
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NCAS-CMS/cf-plot

Tutte le issue di NCAS-CMS/cf-plot

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.