Repository: sphinx-doc/sphinx

Issue:
Sphinx 5.0 autosummary fails with binded cpp module
### Describe the bug

I currently work on a project that includes CPP module binded with pybind11. This means in addition to the classical .py modules, there will be .so modules generated by pybind.

On previous Sphinx versions, the autosummary plugin did not complain about the format of .so modules, but Sphinx 5.0 now fails because of it (see the stack trace below):

```
robin-cls@px-2019:~/dev/sphinx5_autosummary_fail/doc$ sphinx-build . ../buildSphinx v5.0.0 en cours d'exécution
création du dossier de destinataire... fait
[autosummary] engendrement d’un auto-sommaire pour : index.rst

Extension error (sphinx.ext.autosummary):
Le gestionnaire <function process_generate_options at 0x7f842948b670> de l'évènement 'builder-inited' a créé une exception. (exception: source is not a .py file: '/home/robin-cls/dev/sphinx5_autosummary_fail/doc/example.cpython-39-x86_64-linux-gnu.so')
```


### How to Reproduce

I reduced my problem to a simple reproductible case here : https://github.com/robin-cls/sphinx5_autosummary_fail (see the README.MD for generating the binded module and the documentation).



### Expected behavior

I expected a run that properly generates the autosummary for the binded CPP module. Sphinx 4.5 runs without errors and generate HTML documentation for the binded module
```
Sphinx v4.5.0 en cours d'exécution
[autosummary] engendrement d’un auto-sommaire pour : index.rst
[autosummary] engendrement d’un auto-sommaire pour : /home/robin-cls/dev/sphinx5_autosummary_fail/doc/example.rst, /home/robin-cls/dev/sphinx5_autosummary_fail/doc/test.rst
Construction en cours [mo] : cibles périmées pour les fichiers po 0
Construction [html] : cibles périmées pour les fichiers sources 1
Mise à jour de l'environnement : [nouvelle configuration] 3 ajouté(s), 0 modifié(s), 0 supprimé(s)
Lecture des sources... [100%] test                                                                                                                  
Recherche des fichiers périmés... aucun résultat
Environnement de sérialisation... fait
Vérification de la cohérence... fait
Document en préparation... fait
Écriture... [100%] test                                                                                                                             
Génération des index... genindex py-modindex fait
écriture des pages additionnelles... search fait
copie des fichiers statiques... fait
Copie des fichiers complémentaires... fait
Export de l'index de recherche dans English (code: en)... fait
Export de l'inventaire des objets... fait
La compilation a réussi.

Les pages HTML sont dans ../build.
```

### Your project

https://github.com/robin-cls/sphinx5_autosummary_fail

### Screenshots

![image](https://user-images.githubusercontent.com/74916839/171604538-bb364175-f473-492c-b88d-b1e5ba080854.png)


### OS

Linux

### Python version

3.9

### Sphinx version

5.0

### Sphinx extensions

sphinx.ext.autosummary

### Extra tools

_No response_

### Additional context

_No response_

Discussion:

Patch:
diff --git a/CHANGES b/CHANGES
index 2dbb9ae7c..760990e83 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,24 +1,3 @@
-Release 5.1.0 (in development)
-==============================
-
-Dependencies
-------------
-
-Incompatible changes
---------------------
-
-Deprecated
-----------
-
-Features added
---------------
-
-Bugs fixed
-----------
-
-Testing
---------
-
 Release 5.0.1 (in development)
 ==============================
 
@@ -37,6 +16,7 @@ Features added
 Bugs fixed
 ----------
 
+* #10509: autosummary: autosummary fails with a shared library
 * #10498: gettext: TypeError is raised when sorting warning messages if a node
   has no line number
 * #10493: html theme: :rst:dir:`topic` directive is rendered incorrectly with
diff --git a/doc/development/theming.rst b/doc/development/theming.rst
index fcbeb030a..f203429ac 100644
--- a/doc/development/theming.rst
+++ b/doc/development/theming.rst
@@ -248,11 +248,11 @@ Now, you will have access to this function in jinja like so:
 Add your own static files to the build assets
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-By default, Sphinx copies static files on the ``static/`` directory of the template
-directory.  However, if your package needs to place static files outside of the
-``static/`` directory for some reasons, you need to copy them to the ``_static/``
-directory of HTML outputs manually at the build via an event hook.  Here is an
-example of code to accomplish this:
+If you are packaging your own build assets with an extension
+(e.g., a CSS or JavaScript file), you need to ensure that they are placed
+in the ``_static/`` folder of HTML outputs. To do so, you may copy them directly
+into a build's ``_static/`` folder at build time, generally via an event hook.
+Here is some sample code to accomplish this:
 
 .. code-block:: python
 
diff --git a/sphinx/__init__.py b/sphinx/__init__.py
index 3fd1fe0f0..e947380bd 100644
--- a/sphinx/__init__.py
+++ b/sphinx/__init__.py
@@ -21,8 +21,8 @@
 warnings.filterwarnings('ignore', 'The frontend.Option class .*',
                         DeprecationWarning, module='docutils.frontend')
 
-__version__ = '5.1.0+'
-__released__ = '5.1.0'  # used when Sphinx builds its own docs
+__version__ = '5.0.1+'
+__released__ = '5.0.1'  # used when Sphinx builds its own docs
 
 #: Version info for better programmatic use.
 #:
@@ -32,7 +32,7 @@
 #:
 #: .. versionadded:: 1.2
 #:    Before version 1.2, check the string ``sphinx.__version__``.
-version_info = (5, 1, 0, 'beta', 0)
+version_info = (5, 0, 1, 'beta', 0)
 
 package_dir = path.abspath(path.dirname(__file__))
 
diff --git a/sphinx/config.py b/sphinx/config.py
index 8c6dcfe32..15337e924 100644
--- a/sphinx/config.py
+++ b/sphinx/config.py
@@ -164,13 +164,13 @@ def read(cls, confdir: str, overrides: Dict = None, tags: Tags = None) -> "Confi
                               confdir)
         namespace = eval_config_file(filename, tags)
 
-        # Note: Old sphinx projects have been configured as "language = None" because
+        # Note: Old sphinx projects have been configured as "langugae = None" because
         #       sphinx-quickstart previously generated this by default.
         #       To keep compatibility, they should be fallback to 'en' for a while
         #       (This conversion should not be removed before 2025-01-01).
         if namespace.get("language", ...) is None:
             logger.warning(__("Invalid configuration value found: 'language = None'. "
-                              "Update your configuration to a valid language code. "
+                              "Update your configuration to a valid langauge code. "
                               "Falling back to 'en' (English)."))
             namespace["language"] = "en"
 
diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py
index 5ef7b0352..3db7eb989 100644
--- a/sphinx/ext/autosummary/generate.py
+++ b/sphinx/ext/autosummary/generate.py
@@ -155,8 +155,12 @@ def is_skipped(self, name: str, value: Any, objtype: str) -> bool:
 
     def scan(self, imported_members: bool) -> List[str]:
         members = []
-        analyzer = ModuleAnalyzer.for_module(self.object.__name__)
-        attr_docs = analyzer.find_attr_docs()
+        try:
+            analyzer = ModuleAnalyzer.for_module(self.object.__name__)
+            attr_docs = analyzer.find_attr_docs()
+        except PycodeError:
+            attr_docs = {}
+
         for name in members_of(self.object, self.app.config):
             try:
                 value = safe_getattr(self.object, name)


Test patch:
diff --git a/tests/test_config.py b/tests/test_config.py
index 4dabafc83..c0b8864e0 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -411,7 +411,7 @@ def test_conf_py_language_none_warning(logger, tempdir):
     assert logger.warning.called
     assert logger.warning.call_args[0][0] == (
         "Invalid configuration value found: 'language = None'. "
-        "Update your configuration to a valid language code. "
+        "Update your configuration to a valid langauge code. "
         "Falling back to 'en' (English).")