Commit 619943b2 authored by Jason Madden's avatar Jason Madden

Correct a discrpency with __builtins__ in pure-Python vs Cython compiled mode.

parent d17a14c2
......@@ -85,8 +85,13 @@ def get_reachable_greenlets():
# Cache the global memoryview so cython can optimize.
_memoryview = memoryview
try:
_buffer = __builtins__.buffer
except AttributeError:
if isinstance(__builtins__, dict):
# Pure-python mode on CPython
_buffer = __builtins__['buffer']
else:
# Cythonized mode, or PyPy
_buffer = __builtins__.buffer
except (AttributeError, KeyError):
# Python 3.
_buffer = memoryview
......
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