-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug: use
sys
instead of inspect
to obtain stack
`sys` has less dependencies than `inspect` and is trouble-less
- Loading branch information
Showing
1 changed file
with
5 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
import os | ||
import sys | ||
import inspect | ||
|
||
for f in inspect.stack()[1:]: | ||
if not f.filename.startswith('<'): | ||
break | ||
f = sys._getframe(1) | ||
while f.f_code is not None and f.f_code.co_filename.startswith('<'): | ||
f = f.f_back | ||
|
||
if f.filename.startswith(os.path.dirname(os.__file__)): | ||
if f and f.f_code and f.f_code.co_filename.startswith(os.path.dirname(os.__file__)): | ||
if sys.path and sys.path[0] == os.getcwd(): | ||
sys.path = sys.path[1:] | ||
else: | ||
__all__ = ['def_'] | ||
from .keywords import def_ | ||
|
||
del os, sys, inspect, f | ||
del os, sys, f | ||
|
||
__version__ = "0.1.0" |