h5py fails to build with Python 3.14.0b1. ________________________ TestFileObj.test_TemporaryFile ________________________ cls = <class '_pytest.runner.CallInfo'> func = <function call_and_report.<locals>.<lambda> at 0x7f98e1a26140> when = 'call' reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>) @classmethod def from_call( cls, func: Callable[[], TResult], when: Literal["collect", "setup", "call", "teardown"], reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None, ) -> CallInfo[TResult]: """Call func, wrapping the result in a CallInfo. :param func: The function to call. Called without arguments. :type func: Callable[[], _pytest.runner.TResult] :param when: The phase in which the function is called. :param reraise: Exception or exceptions that shall propagate if raised by the function, instead of being wrapped in the CallInfo. """ excinfo = None start = timing.time() precise_start = timing.perf_counter() try: > result: TResult | None = func() /usr/lib/python3.14/site-packages/_pytest/runner.py:341: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.14/site-packages/_pytest/runner.py:242: in <lambda> lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise /usr/lib/python3.14/site-packages/pluggy/_hooks.py:513: in __call__ return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) /usr/lib/python3.14/site-packages/pluggy/_manager.py:120: in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /usr/lib/python3.14/site-packages/_pytest/threadexception.py:92: in pytest_runtest_call yield from thread_exception_runtest_hook() /usr/lib/python3.14/site-packages/_pytest/threadexception.py:68: in thread_exception_runtest_hook yield /usr/lib/python3.14/site-packages/_pytest/unraisableexception.py:95: in pytest_runtest_call yield from unraisable_exception_runtest_hook() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def unraisable_exception_runtest_hook() -> Generator[None]: with catch_unraisable_exception() as cm: try: yield finally: if cm.unraisable: if cm.unraisable.err_msg is not None: err_msg = cm.unraisable.err_msg else: err_msg = "Exception ignored in" msg = f"{err_msg}: {cm.unraisable.object!r}\n\n" msg += "".join( traceback.format_exception( cm.unraisable.exc_type, cm.unraisable.exc_value, cm.unraisable.exc_traceback, ) ) > warnings.warn(pytest.PytestUnraisableExceptionWarning(msg)) E pytest.PytestUnraisableExceptionWarning: Exception ignored while calling deallocator <function _TemporaryFileCloser.__del__ at 0x7f9908ab3320>: None E E Traceback (most recent call last): E File "/usr/lib64/python3.14/tempfile.py", line 483, in __del__ E _warnings.warn(self.warn_message, ResourceWarning) E ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E ResourceWarning: Implicitly cleaning up <_TemporaryFileWrapper file=<_io.BufferedRandom name='/tmp/tmp86bropaf'>> https://docs.python.org/3.14/whatsnew/3.14.html For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.14-b1/fedora-rawhide-x86_64/09027578-h5py/ For all our attempts to build h5py with Python 3.14, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.14-b1/package/h5py/ Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.14: https://copr.fedorainfracloud.org/coprs/g/python/python3.14-b1/ Let us know here if you have any questions. Python 3.14 is planned to be included in Fedora 43. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
Hmm, this seems more like a problem in pytest and/or python proper than h5py? I fail see how h5py can fix this problem?
Looking at the test code, it seems to me the intent was to ignore the ResourceWarning which may happen with the test, but for some reason the test does not behave that way. I also see that there was a change in treating warnings as errors in the source code: https://github.com/h5py/h5py/commit/5a35e56eafbd68cef1906731cefdcdbe9c21c86e Maybe it's worth raising upstream that the issue is not fully resolved for Linux/Py 3.14/pytest 8+. @pytest.mark.filterwarnings( # on Windows, a resource warning may be emitted # when this test returns "ignore:unclosed file:ResourceWarning" ) def test_TemporaryFile(self): # in this test, we check explicitly that temp file gets # automatically deleted upon h5py.File.close()... fileobj = tempfile.NamedTemporaryFile() fname = fileobj.name f = h5py.File(fileobj, 'w') del fileobj # ... but in your code feel free to simply # f = h5py.File(tempfile.TemporaryFile()) f.create_dataset('test', data=list(range(12))) self.assertEqual(list(f), ['test']) self.assertEqual(list(f['test'][:]), list(range(12))) self.assertTrue(os.path.isfile(fname)) f.close() self.assertFalse(os.path.isfile(fname))
I ran a build with a change that succeeded in our environment, with this added in %prep: +sed -i 's/"ignore:unclosed file:ResourceWarning"/"ignore::ResourceWarning"/' %{name}-%{version}/h5py/tests/test_file2.py I don't know whether this is specific to Linux and different on Windows or not.
https://src.fedoraproject.org/rpms/h5py/pull-request/12
PR merged