Message254532
To add some info why we hit that bug:
https://bugs.python.org/issue24305 changed the warning stacklevel needed for import warnings from 8 to 2. As a result any code doing import warnings will likely hit that edge case when run with 3.5 and openafs installed. But I'm not sure if there is much code out there doing import warnings.. so ymmv.
For anyone with the same problem looking for a workaround:
I went through all Python versions and searched for the needed stacklevel.
def get_import_stacklevel(import_hook):
"""Returns the stacklevel value for warnings.warn() for when the warning
gets emitted by an imported module, but the warning should point at the
code doing the import.
Pass import_hook=True if the warning gets generated by an import hook
(warn() gets called in load_module(), see PEP302)
"""
py_version = sys.version_info[:2]
if py_version <= (3, 2):
# 2.7 included
return 4 if import_hook else 2
elif py_version == (3, 3):
return 8 if import_hook else 10
elif py_version == (3, 4):
return 10 if import_hook else 8
else:
# fixed again in 3.5+, see https://bugs.python.org/issue24305
return 4 if import_hook else 2 |
|
Date |
User |
Action |
Args |
2015-11-12 15:00:32 | lazka | set | recipients:
+ lazka, brett.cannon, Arfrever, r.david.murray, serhiy.storchaka, bevan |
2015-11-12 15:00:32 | lazka | set | messageid: <1447340432.32.0.277054597076.issue25493@psf.upfronthosting.co.za> |
2015-11-12 15:00:32 | lazka | link | issue25493 messages |
2015-11-12 15:00:31 | lazka | create | |
|