agronholm / agronholm/typeguard

NameError on pkg_resources

Ouverte
#401 27 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug
Langage dominant
Python
Étoiles
1.8k
Forks
145
Merge moyen
8 j 12 h
PR mergées (30 j)
1

Description

### Things to check first

- [X] I have searched the existing issues and didn't find my bug already reported there

- [X] I have checked that my bug is still present in the latest release

### Typeguard version

4.1.4

### Python version

3.10.12

### What happened?

```
Traceback (most recent call last):
File "test.py", line 3, in
import pkg_resources
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "/home/devel/.local/lib/python3.10/site-packages/typeguard/_importhook.py", line 98, in exec_module
super().exec_module(module)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 77, in
__import__('pkg_resources.extern.packaging.specifiers')
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "/home/devel/.local/lib/python3.10/site-packages/typeguard/_importhook.py", line 98, in exec_module
super().exec_module(module)
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/specifiers.py", line 317, in
class Specifier(_IndividualSpecifier):
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/specifiers.py", line 426, in Specifier
def _compare_compatible(self, prospective: ParsedVersion, spec: str) -> bool:
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/specifiers.py", line 306, in _require_version_compare
fn: Callable[["Specifier", ParsedVersion, str], bool]
NameError: name 'Specifier' is not defined. Did you mean: 'BaseSpecifier'?
```

### How can we reproduce the bug?

`test.py`:
```python3
from typeguard import install_import_hook
with install_import_hook(('pkg_resources',)):
import pkg_resources
```

```shell
$ python3 test.py

```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.