Why does “help('modules')” produce a ResourceWarning

Why does help('modules') [1] produce “/usr/lib64/python3.14/tempfile.py:484: ResourceWarning: Implicitly cleaning up <_TemporaryFileWrapper file=<_io.TextIOWrapper name='/tmp/Solaar_e4p94b_p' mode='w' encoding='UTF-8'>>” (for me)?

RokeJulianLockhart@Beedell:~$ python3
Python 3.14.2 (main, Dec  5 2025, 00:00:00) [GCC 15.2.1 20251111 (Red Hat 15.2.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help('modules')

Please wait a moment while I gather a list of all available modules...

Crypto              attrs               imathnumpy          regex
Cryptodome          audit               importlib           report
Cython              augeas              importlib_metadata  reportclient
IPython             auparse             inflect             reprlib
OpenImageIO         autocommand         initial_setup       requests
OpenSSL             babel               inkex               requests_file
PIL                 backports           inspect             requests_ftp
PyOpenColorIO       base64              io                  resource
PyQt5               bdb                 ipaddress           rlcompleter
PyQt6               beaker              iso639              roman_numerals
PySide6             bezmisc             itertools           rpds
Screenkey           binascii            jc                  rpm
Xlib                bisect              jedi                run_command
__future__          blessed             jinja2              runpy
__hello__           blessings           jmespath            s3transfer
_abc                blivet              json                satyr
_aix_support        blivetgui           jsonschema          sched
_android_support    blueman             jsonschema_specifications scour
_apple_support      boto3               keysyms             sdkmanager
_ast                botocore            keyword             secrets
_ast_unparse        bpdb                langtable           select
_asyncio            bpython             libcomps            selectors
_audit              brlapi              libdnf              selinux
_augeas             brotli              libdnf5             semanage
_bisect             bs4                 libmount            sentry_sdk
_blake2             bsddb3              libvirt             seobject
_blueman            build               libvirt_lxc         sepolgen
_brotli             builtins            libvirt_qemu        sepolicy
_bz2                bytesize            libvirtaio          serial
_capng              bz2                 libvirtmod          setools
_cffi_backend       cProfile            libvirtmod_lxc      setproctitle
_codecs             cairo               libvirtmod_qemu     setroubleshoot
_codecs_cn          calendar            libxml2             setuptools
_codecs_hk          capng               libxml2mod          shelve
_codecs_iso2022     certifi             linecache           shiboken6
_codecs_jp          cffi                lldb                shiboken6_generator
_codecs_kr          cgi                 locale              shlex
_codecs_tw          cgitb               logging             shutil
_collections        chardet             logitech_receiver   signal
_collections_abc    charset_normalizer  looseversion        simpleaudio
_colorize           click               louis               simpleline
_compat_pickle      cmath               lvmdbusd            simplepath
_contextvars        cmd                 lxml                simplestyle
_crypt_r            cockpit             lzma                simpletransform
_csv                code                magic               site
_ctypes             codecs              mailbox             six
_curses             codeop              mako                smartypants
_curses_panel       collections         markdown            smtplib
_datetime           colorsys            markupsafe          sniffio
_dbm                compileall          marshal             snowballstemmer
_dbus_bindings      compression         math                socket
_dbus_glib_bindings concurrent          matplotlib_inline   socketserver
_decimal            configparser        meh                 socks
_distutils_hack     contextlib          mercurial           sockshandler
_elementtree        contextvars         mesonbuild          solaar
_functools          copy                mimetypes           sos
_gdbm               copyreg             mmap                soupsieve
_hashlib            crypt               modulefinder        speechd
_heapq              crypt_r             more_itertools      speechd_config
_hmac               cryptography        multiprocessing     sphinx
_imp                cspsubdiv           mutagen             sqlite3
_interpchannels     cssselect           netrc               sre_compile
_interpqueues       csv                 nftables            sre_constants
_interpreters       ctypes              ninja_syntax        sre_parse
_io                 cubicsuperpath      ntpath              ssl
_ios_support        cups                nturl2path          stack_data
_json               cupshelpers         numbers             stat
_locale             curl                numexpr             statistics
_lsprof             curses              numpy               string
_lzma               curtsies            officehelper        stringprep
_markupbase         cwcwidth            olefile             struct
_md5                cython              opcode              structlog
_multibytecodec     dasbus              operator            subprocess
_multiprocessing    dataclasses         optparse            symtable
_opcode             datetime            orca                sys
_opcode_metadata    dateutil            ordlookup           sysconfig
_operator           dbm                 orjson              syslog
_osx_support        dbus                os                  systemd
_ped                dbus_next           packaging           tabnanny
_pickle             decimal             parso               tarfile
_posixshmem         decorator           parted              tempfile
_posixsubprocess    difflib             pathlib             termios
_py_abc             dis                 pathvalidate        textwrap
_py_warnings        distro              patoolib            this
_pydatetime         dnf                 pdb                 threading
_pydecimal          dnfpluginscore      pefile              time
_pyio               doctest             perf                timeit
_pylong             docutils            peutils             tinycss2
_pyrepl             drv_libxml2         pexpect             tkinter
_queue              email               pickle              token
_random             enchant             pickletools         tokenize
_raw_pylibcpupower  encodings           pid                 tomli
_remote_debugging   ensurepip           pip                 tomllib
_ruamel_yaml        enum                pkg_resources       trace
_selinux            errno               pkgutil             traceback
_semanage           evdev               platform            tracemalloc
_sha1               executing           platformdirs        traitlets
_sha2               faulthandler        plistlib            trashcli
_sha3               fc_solve_find_index_s2ints ply                 tty
_signal             fcntl               pmb                 tuned
_sitebuiltins       fedora_third_party  poplib              turtle
_socket             ffgeom              posix               turtledemo
_sqlite3            filecmp             posixpath           typeguard
_sre                fileinput           pprint              types
_ssl                firewall            problem             typing
_stat               fnmatch             procfs              typing_extensions
_statistics         fractions           productmd           typogrify
_string             ftplib              profile             umu
_strptime           functools           prompt_toolkit      unbound
_struct             fvs                 pstats              unboundmodule
_suggestions        gbinder             psutil              unicodedata
_symtable           gc                  pty                 unittest
_sysconfig          genericpath         ptyprocess          uno
_sysconfigdata__linux_x86_64-linux-gnu getopt              pure_eval           unohelper
_thread             getpass             pwd                 urllib
_threading_local    gettext             pwquality           urllib3
_tkinter            gi                  py_compile          uuid
_tokenize           gidocgen            pyanaconda          venv
_tracemalloc        glob                pyatspi             vkbasalt
_types              gnome_abrt          pyaudio             warnings
_typing             gramps              pyclbr              watchdog
_unbound            graphlib            pyclip              wave
_uuid               greenlet            pycparser           wcwidth
_warnings           grp                 pycurl              weakref
_weakref            gzip                pydoc               webbrowser
_weakrefset         h11                 pydoc_data          webencodings
_yaml               hashlib             pyexpat             websockets
_zoneinfo           hawkey              pygdbmi             wheel
_zstd               heapq               pygments            wsgiref
abc                 hgdemandimport      pygtkcompat         xdg
abrt_exception_handler3 hgext               pyinotify           xkbregistry
abrtcli             hgext3rd            pykickstart         xml
accerciser          hid_parser          pyparsing           xmlrpc
alabaster           hidapi              pyproj              xmltodict
annotationlib       hmac                pyproject_hooks     yaml
antigravity         html                pyudev              yt_dlp
anyio               http                pyximport           zipapp
appdirs             httpcore            pyynl               zipfile
argcomplete         httpx               queue               zipimport
argparse            humanize            quopri              zipp
array               icoextract          random              zlib
ast                 icu                 rapidfuzz           zoneinfo
asttokens           idna                raw_pylibcpupower   zstandard
asyncio             imagesize           re                  
atexit              imaplib             readline            
attr                imath               referencing         

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".

>>> exit
/usr/lib64/python3.14/tempfile.py:484: ResourceWarning: Implicitly cleaning up <_TemporaryFileWrapper file=<_io.TextIOWrapper name='/tmp/Solaar_ekh22emj' mode='w' encoding='UTF-8'>>

I ask because I observe evidence that this is problematic:

My Environment

Name        : python3
Version     : 3.14.2
Release     : 1.fc43
Architecture: x86_64
Install Date: Wed 10 Dec 2025 14:32:28 GMT
Size        : 29561
Signature   :
              RSA/SHA256, Sat 06 Dec 2025 23:48:16 GMT, Key ID 829b606631645531
Source RPM  : python3.14-3.14.2-1.fc43.src.rpm
Build Date  : Sat 06 Dec 2025 21:28:11 GMT
Build Host  : buildvm-x86-20.rdu3.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
Bug URL     : https://bugz.fedoraproject.org/python3.14

bugzilla.mozilla.org/show_bug.cgi?id=2008656#ct-0 describes all of the rest.


  1. stackoverflow.com/revisions/740018/1 [2] ↩︎

  2. stackoverflow.com/questions/11248073#comment140929700_49200334 ↩︎

1 Like

help('modules') iterates over installed modules executing them in the process. In this case, it looks like one, solaar I’d guess based on the temporary filename, opened a tempfile but did not close it. Unfortunately the warning is coming from the tempfile CPython library and doesn’t give the line that opened the file.

Searching the solaar Python package I found a global line in Solaar/lib/solaar/gtk.py at fc6852173173d91ffd383d1c285f031d8e95983b · pwr-Solaar/Solaar · GitHub which does seem to be opening a tempfile on import and not closing it. Ideally importing the package wouldn’t have the side effect of opening a file.

For this sort of issue I typically try to fix the issue upstream. If it’s causing active issues in your project it should be possible to use The Warnings Filter to suppress the warning.

3 Likes

@cmaloney, thank you! I have reported it:

1 Like

I’m having a really difficult time convincing the project owner that this actually is a bug. Perhaps, I’m somehow incomprehensible to them. If anyone can corroborate, I’d appreciate it. If not, no worries.

I don’t know anything about that library, but the last comment on the ticket seems to indicate that the maintainers’ position is that they don’t care what happens for any usage of their library outside their own system. It also looks like they have a rather lengthy template for tickets that may be causing the actual issue to be less prominent.

If I were reporting this, rather than focusing on the help issue, I’d be tempted to just focus on “this module opens a tempfile at the global module level and that is not a good practice”.

You could also just try to make a PR. Looking at the code, it seems that it might work to move the tempfile creation inside main. That is where the code is to close the tempfile; it’s just that since the code to create the tempfile is outside main, it never gets closed if main is never run. Obviously I haven’t tested this but you could try it and if it works then submit it as a PR.

Based on the thread I’m not sure the maintainers would be receptive to this but it could be worth a try.

I would find it confusing if someone opened an issue like that. The title is too long and you have dumped loads of irrelevant stuff in to the issue description. My reaction would probably be similar to theirs e.g.:

You may have used that as the basis, but then something was done that caused the issue to appear very differently than other issues - to the point that it is unclear what the problem is. Please generate an issue that looks like the other issues.

My guess from seeing the first edit is that you took the issue template and pasted it into chatgpt which then generated an incomprehensible mess that you pasted into github.

Or did you actually use something like Cursor and ask Cursor to open the issue for you? I’m certainly seeing PRs these days where it seems like someone is using some piece of AI-integrated software that does things like opening a PR by web API without the person actually going to the GitHub website. Those often have embedded links like the ones in your original edit markdown.

I think those links are supposed to be part of the way that the Cursor editor shows things (you can click on parts of the chatbot output to link through to code in the editor) but it seems odd to me that someone actually looking at the raw markdown would include them when pasting into GitHub so I assume that they actually just clicked a button to have their software send the raw markdown to GitHub. The alternative explanation is that they have not attempted to read the markdown before pasting chatbot output straight into someone else’s inbox.

1 Like