Skip to content

Commit 70b4509

Browse files
authored
Merge pull request pallets#2962 from garenchan/dev
Cache return values to avoid repeated function calls.
2 parents 673772c + 9bc87d0 commit 70b4509

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

flask/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,9 @@ def prepare_import(path):
206206
"""
207207
path = os.path.realpath(path)
208208

209-
if os.path.splitext(path)[1] == '.py':
210-
path = os.path.splitext(path)[0]
209+
fname, ext = os.path.splitext(path)
210+
if ext == '.py':
211+
path = fname
211212

212213
if os.path.basename(path) == '__init__':
213214
path = os.path.dirname(path)

0 commit comments

Comments
 (0)