GeezerVison is showing github.com — Test suite expects _stat extension to be available · Issue #108638 · python/cpython
Test suite expects _stat extension to be available #108638DescriptionBug report
Checklist
- I am confident this is a bug in CPython, not a bug in a third-party project
- I have searched the CPython issue tracker,
and am confident this bug has not been reported before
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
No response
A clear and concise description of the bug:
The _stat extension is specific to CPython. For example, PyPy has no _stat module.
But the Python test suite expects the _stat module to be available: test_inspect, test_pydoc, and test_tarfile fail with it's missing.
Disable compilation of the _stat extension to reproduce the issue:
diff --git a/Modules/Setup.bootstrap.in b/Modules/Setup.bootstrap.in
index 8ef0f203a8..a1f6b8cc85 100644
--- a/Modules/Setup.bootstrap.in
+++ b/Modules/Setup.bootstrap.in
@@ -29,7 +29,7 @@ _abc _abc.c
_functools _functoolsmodule.c
_locale _localemodule.c
_operator _operator.c
-_stat _stat.c
+#_stat _stat.c
_symtable symtablemodule.c
# for systems without $HOME env, used by site._getuserbase()
Example:
$ ./python -c 'import _stat'
ModuleNotFoundError: No module named '_stat'
Linked PRs
Activitysobolevn commented on Aug 29, 2023 Some time ago I opened the exact same issue, but about _functools extension.
Tests is written in a way that expect _functools to always be there. However, other iterpreters may not have it.
My PR was rejected :(
https://bugs.python.org/issue46647 vstinner commented on Aug 29, 2023
Some time ago I opened the exact same issue, but about _functools extension.
pypy3 (PyPy 3.9.16 v7.3.12) doesn't have the _functools module, but pypy2 (PyPy 2.7.18 v7.3.12) has the _functools module. It may help to make test_functools compatible with PyPy to support the case when _functools is missing. I didn't look if your proposed change make functools and/or test_functools maintenance too complicated or not. sunmy2019 commented on Aug 29, 2023
The _stat extension is specific to CPython. For example, PyPy has _stat module.
Do you mean "PyPy doesn't have _stat module"? vstinner commented on Aug 29, 2023
Do you mean "PyPy doesn't have _stat module"?
Oops, right:
$ pypy3
Python 3.9.17 (a61d7152b989, Aug 13 2023, 10:27:46)
[PyPy 7.3.12 with GCC 13.2.1 20230728 (Red Hat 13.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>> import _stat
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named '_stat'
gvanrossum commented on Aug 29, 2023 vstinner commented on Aug 29, 2023 test_inspect and test_pydoc still fail. I reopen the issue.
I'm not sure if it's better to change _stat and/or stat functions signature, or skip the affected tests when _stat is not available. gvanrossum commented on Aug 29, 2023
I'm not sure if it's better to change _stat and/or stat functions signature, or skip the affected tests when _stat is not available.
Whichever is the simplest fix, I'd say. vstinner commented on Aug 31, 2023 The whole test suite now pass when the _stat extension is missing. I close the issue.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|