aboutsummaryrefslogtreecommitdiffstats
path: root/python/gevent/_greenlet_primitives.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2019-09-06 16:31:13 -0700
committerJames Taylor <user234683@users.noreply.github.com>2019-09-06 16:31:13 -0700
commit3d57e14df7ba5f14a634295caf3b2e60da50bfe2 (patch)
tree4903bcb79a49ad714a1a9129765b9545405c9978 /python/gevent/_greenlet_primitives.py
parentac32b24b2a011292b704a3f27e8fd08a7ae9424b (diff)
downloadyt-local-3d57e14df7ba5f14a634295caf3b2e60da50bfe2.tar.lz
yt-local-3d57e14df7ba5f14a634295caf3b2e60da50bfe2.tar.xz
yt-local-3d57e14df7ba5f14a634295caf3b2e60da50bfe2.zip
Remove windows python distribution from repo and add requirements.txt
Diffstat (limited to 'python/gevent/_greenlet_primitives.py')
-rw-r--r--python/gevent/_greenlet_primitives.py74
1 files changed, 0 insertions, 74 deletions
diff --git a/python/gevent/_greenlet_primitives.py b/python/gevent/_greenlet_primitives.py
deleted file mode 100644
index 706f71b..0000000
--- a/python/gevent/_greenlet_primitives.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- coding: utf-8 -*-
-# copyright (c) 2018 gevent. See LICENSE.
-# cython: auto_pickle=False,embedsignature=True,always_allow_keywords=False
-"""
-A collection of primitives used by the hub, and suitable for
-compilation with Cython because of their frequency of use.
-
-"""
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-from weakref import ref as wref
-
-from greenlet import greenlet
-
-from gevent.exceptions import BlockingSwitchOutError
-
-
-# In Cython, we define these as 'cdef inline' functions. The
-# compilation unit cannot have a direct assignment to them (import
-# is assignment) without generating a 'lvalue is not valid target'
-# error.
-locals()['getcurrent'] = __import__('greenlet').getcurrent
-locals()['greenlet_init'] = lambda: None
-locals()['_greenlet_switch'] = greenlet.switch
-
-__all__ = [
- 'TrackedRawGreenlet',
- 'SwitchOutGreenletWithLoop',
-]
-
-class TrackedRawGreenlet(greenlet):
-
- def __init__(self, function, parent):
- greenlet.__init__(self, function, parent)
- # See greenlet.py's Greenlet class. We capture the cheap
- # parts to maintain the tree structure, but we do not capture
- # the stack because that's too expensive for 'spawn_raw'.
-
- current = getcurrent() # pylint:disable=undefined-variable
- self.spawning_greenlet = wref(current)
- # See Greenlet for how trees are maintained.
- try:
- self.spawn_tree_locals = current.spawn_tree_locals
- except AttributeError:
- self.spawn_tree_locals = {}
- if current.parent:
- current.spawn_tree_locals = self.spawn_tree_locals
-
-
-class SwitchOutGreenletWithLoop(TrackedRawGreenlet):
- # Subclasses must define:
- # - self.loop
-
- # This class defines loop in its .pxd for Cython. This lets us avoid
- # circular dependencies with the hub.
-
- def switch(self):
- switch_out = getattr(getcurrent(), 'switch_out', None) # pylint:disable=undefined-variable
- if switch_out is not None:
- switch_out()
- return _greenlet_switch(self) # pylint:disable=undefined-variable
-
- def switch_out(self):
- raise BlockingSwitchOutError('Impossible to call blocking function in the event loop callback')
-
-def _init():
- greenlet_init() # pylint:disable=undefined-variable
-
-_init()
-
-from gevent._util import import_c_accel
-import_c_accel(globals(), 'gevent.__greenlet_primitives')