Commit 032cd636 authored by Jason R. Coombs's avatar Jason R. Coombs

Patch globals in a function. This technique bypasses the linter warnings about...

Patch globals in a function. This technique bypasses the linter warnings about the names not being present, and allows for better documentation.
parent ac86a30d
......@@ -197,8 +197,19 @@ def extract_constant(code, symbol, default=-1):
else:
const = default
if sys.platform.startswith('java') or sys.platform == 'cli':
# XXX it'd be better to test assertions about bytecode instead...
del extract_constant, get_module_constant
__all__.remove('extract_constant')
__all__.remove('get_module_constant')
def _update_globals():
"""
Patch the globals to remove the objects not available on some platforms.
XXX it'd be better to test assertions about bytecode instead.
"""
if not sys.platform.startswith('java') and sys.platform != 'cli':
return
incompatible = 'extract_constant', 'get_module_constant'
for name in incompatible:
del globals()[name]
__all__.remove(name)
_update_globals()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment