GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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 #108638

New issue
Copy link
New issue
Copy link
Closed
Closed
Test suite expects _stat extension to be available#108638
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@vstinner
vstinner
opened on Aug 29, 2023
Issue body actions

Bug 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

  • gh-108638: Fix stat.filemode() when _stat is missing #108639
  • gh-108638: Fix tests when _stat extension is missing #108689

Activity

  1. vstinner
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Aug 29, 2023
  2. vstinner
    added 5 commits that reference this issue on Aug 29, 2023

    pythongh-108638: Fix tests when _stat extension is missing

    d2ad982

    pythongh-108638: Fix stat.filemode() when _stat is missing

    b0d7f0c

    pythongh-108638: Fix stat.filemode() when _stat is missing

    8f41eaf

    pythongh-108638: Fix stat.filemode() when _stat is missing

    74062c3

    pythongh-108638: Fix stat.filemode() when _stat is missing

    ce5c938
  3. sobolevn commented on Aug 29, 2023

    @sobolevn
    sobolevn
    on Aug 29, 2023
    Member
    More actions

    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

  4. vstinner commented on Aug 29, 2023

    @vstinner
    vstinner
    on Aug 29, 2023
    MemberAuthor
    More actions

    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.

  5. sunmy2019 commented on Aug 29, 2023

    @sunmy2019
    sunmy2019
    on Aug 29, 2023
    Member
    More actions

    The _stat extension is specific to CPython. For example, PyPy has _stat module.

    Do you mean "PyPy doesn't have _stat module"?

  6. vstinner commented on Aug 29, 2023

    @vstinner
    vstinner
    on Aug 29, 2023
    MemberAuthor
    More actions

    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'
    
  7. vstinner
    added a commit that references this issue on Aug 29, 2023

    gh-108638: Fix stat.filemode() when _stat is missing (#108639)

    b62a760
  8. gvanrossum commented on Aug 29, 2023

    @gvanrossum
    gvanrossum
    on Aug 29, 2023
    Member
    More actions

    Seems fixed now.

  9. gvanrossum
    closed this as completedon Aug 29, 2023
  10. vstinner commented on Aug 29, 2023

    @vstinner
    vstinner
    on Aug 29, 2023
    MemberAuthor
    More actions

    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.

  11. vstinner
    reopened this on Aug 29, 2023
  12. gvanrossum commented on Aug 29, 2023

    @gvanrossum
    gvanrossum
    on Aug 29, 2023
    Member
    More actions

    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.

  13. vstinner
    added 3 commits that reference this issue on Aug 30, 2023

    pythongh-108638: Fix tests when _stat extension is missing

    81d20a7

    pythongh-108638: Fix tests when _stat extension is missing

    e2b47d0

    gh-108638: Fix tests when _stat extension is missing (#108689)

    c6d5613
  14. vstinner commented on Aug 31, 2023

    @vstinner
    vstinner
    on Aug 31, 2023
    MemberAuthor
    More actions

    The whole test suite now pass when the _stat extension is missing. I close the issue.

  15. vstinner
    closed this as completedon Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.