Skip to content

Commit 166268a

Browse files
authored
Merge pull request python-mode#993 from diraol/fix_pkg_resources
Get the package loader instead of its spec.
2 parents 81a4f6e + dff0075 commit 166268a

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

AUTHORS

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,34 @@ Maintainers:
99
Contributors:
1010

1111
* Alvin Francis (http://github.com/alvinfrancis);
12-
* Amir Eldor (https://github.com/amireldor)
13-
* Andriy Kohut (https://github.com/andriykohut)
12+
* Amir Eldor (https://github.com/amireldor);
13+
* Andriy Kohut (https://github.com/andriykohut);
1414
* Anler Hp (http://github.com/ikame);
1515
* Anton Parkhomenko (http://github.com/chuwy);
1616
* Ashley Hewson (http://github.com/ashleyh);
1717
* Ben Davis (https://github.com/bendavis78);
1818
* Benjamin Ruston (http://github.com/bruston);
19-
* Boatx (https://github.com/boatx)
19+
* Boatx (https://github.com/boatx);
2020
* Boris Filippov (http://github.com/frenzykryger);
2121
* Brad Belyeu (https://github.com/bbelyeu);
22-
* Brad Mease (http://github.com/bmease)
23-
* Brendan Maguire (https://github.com/brendanmaguire)
24-
* Bryce Guinta (https://github.com/brycepg)
25-
* Daniel Hahler (http://github.com/blueyed)
22+
* Brad Mease (http://github.com/bmease);
23+
* Brendan Maguire (https://github.com/brendanmaguire);
24+
* Bryce Guinta (https://github.com/brycepg);
25+
* Daniel Hahler (http://github.com/blueyed);
2626
* David Vogt (http://github.com/winged);
2727
* Denis Kasak (http://github.com/dkasak);
28-
* Diego Rabatone Oliveira (https://github.com/diraol)
28+
* Diego Rabatone Oliveira (https://github.com/diraol);
2929
* Dimitrios Semitsoglou-Tsiapos (https://github.com/dset0x);
3030
* Dirk Wallenstein (http://github.com/dirkwallenstein);
31-
* Filip Poboril (https://github.com/fpob)
31+
* Filip Poboril (https://github.com/fpob);
3232
* Florent Xicluna (http://github.com/florentx);
3333
* Fredrik Henrysson (http://github.com/fhenrysson);
3434
* fwuzju (https://github.com/fwuzju);
3535
* Grzegorz Janik (http://github.com/glujan);
3636
* Igor Guerrero (http://github.com/igorgue);
37-
* Jacob Niehus (https://github.com/wilywampa)
38-
* Jason Harvey (http://github.com/alienth)
39-
* Jay Rainey (https://github.com/jawrainey)
37+
* Jacob Niehus (https://github.com/wilywampa);
38+
* Jason Harvey (http://github.com/alienth);
39+
* Jay Rainey (https://github.com/jawrainey);
4040
* Jonathan McCall (http://github.com/Jonnymcc);
4141
* Kevin Deldycke (http://github.com/kdeldycke);
4242
* Kurtis Rader (https://github.com/krader1961);

pymode/libs/pkg_resources/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,14 +2188,19 @@ def _handle_ns(packageName, path_item):
21882188
# As `find_module` is deprecated for newer python, we try `find_spec`
21892189
# first.
21902190
try:
2191-
loader = importer.find_spec(packageName)
2191+
spec = importer.find_spec(packageName)
2192+
if spec:
2193+
loader = spec.loader
2194+
else:
2195+
return None
21922196
except AttributeError:
21932197
loader = importer.find_module(packageName)
21942198
else:
21952199
try:
21962200
loader = importer.find_module(packageName)
21972201
except ImportError:
2198-
loader = None
2202+
return None
2203+
21992204
if loader is None:
22002205
return None
22012206

0 commit comments

Comments
 (0)