Prepare for python 3.13
I've found references to `__file__` in your package:
https://github.com/tonsky/Clojure-Sublimed/blob/edadce32e9b4909dccd91296109970d3be8d6e31/cs_common.py#L283
As modern python 3.1x releases move on towards `__spec__` and drop support for `__file__` and `__package__` globals, it is recommended to replace relevant references to ensure compatibility with upcoming ST dev builds.
If this package targets ST4 and python 3.8+ it is an easy change by just replacing:
- `__file__` => `__spec__.origin`
- `__package__` => `__spec__.parent`
Python 3.3 doesn't support `__spec__` and would require a fallback.
A common pattern might be
```py
try:
package_path = os.path.dirname(__spec__.origin)
except (AttributeError, NameError):
package_path = os.path.dirname(__file__)
```
0 条评论