Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
1c8b1c5a
Commit
1c8b1c5a
authored
Feb 26, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doc tweaks.
parent
111521eb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
39 deletions
+54
-39
CHANGES.rst
CHANGES.rst
+5
-4
doc/conf.py
doc/conf.py
+13
-2
doc/gevent.rst
doc/gevent.rst
+0
-2
src/gevent/_greenlet.pxd
src/gevent/_greenlet.pxd
+4
-2
src/gevent/_ssl2.py
src/gevent/_ssl2.py
+6
-4
src/gevent/greenlet.py
src/gevent/greenlet.py
+26
-25
No files found.
CHANGES.rst
View file @
1c8b1c5a
...
...
@@ -97,7 +97,8 @@
offset any performance decrease due to :issue:`755`. Please open
issues for any compatibility concerns. See :pr:`1115` and :pr:`1120`.
- Greenlet objects now have a ``minimal_ident`` property. It functions
- Greenlet objects now have a `minimal_ident
<gevent.Greenlet.minimal_ident>` property. It functions
similarly to ``Thread.ident`` or ``id`` by uniquely identifying the
greenlet object while it remains alive, and it can be reused after
the greenlet object is dead. It is different in that it is small and
...
...
@@ -105,14 +106,14 @@
Hashemi and Kurt Rose. See :issue:`755`. As always, feedback is
appreciated.
- Simple subclasses of `
`gevent.local.local`
` now have the same
- Simple subclasses of `
gevent.local.local
` now have the same
(substantially improved) performance characteristics of plain
`
`gevent.local.local`
` itself, making them 2 to 3 times faster than
`
gevent.local.local
` itself, making them 2 to 3 times faster than
before. See :pr:`1117`. If there are any compatibility
problems, please open issues.
- On CPython, allow the pure-Python implementations of
`
`gevent.greenlet``, ``gevent.local`` and ``gevent.sempahore`
` to be
`
gevent.Greenlet`, `gevent.local` and `gevent.lock
` to be
used when the environment variable ``PURE_PYTHON`` is set. This is
not recommended except for debugging and testing. See :issue:`1118`.
...
...
doc/conf.py
View file @
1c8b1c5a
...
...
@@ -15,6 +15,10 @@ from __future__ import print_function
import
sys
import
os
# Use the python versions instead of the cython compiled versions
# for better documentation extraction and ease of tweaking docs.
os
.
environ
[
'PURE_PYTHON'
]
=
'1'
os
.
system
(
'%s generate_rst.py generate'
%
sys
.
executable
)
sys
.
path
.
append
(
'.'
)
# for mysphinxext
...
...
@@ -28,8 +32,14 @@ sys.path.append('.') # for mysphinxext
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions
=
[
'sphinx.ext.autodoc'
,
'sphinx.ext.doctest'
,
'sphinx.ext.coverage'
,
'sphinx.ext.intersphinx'
,
'mysphinxext'
,
'sphinx.ext.extlinks'
]
extensions
=
[
'sphinx.ext.autodoc'
,
'sphinx.ext.doctest'
,
'sphinx.ext.coverage'
,
'sphinx.ext.intersphinx'
,
'mysphinxext'
,
'sphinx.ext.extlinks'
,
]
intersphinx_mapping
=
{
'http://docs.python.org/'
:
None
,
'https://greenlet.readthedocs.io/en/latest/'
:
None
}
...
...
@@ -152,6 +162,7 @@ html_short_title = 'Documentation'
# typographically correct entities.
# This is true by default in sphinx 1.6
html_use_smartypants
=
True
smartquotes
=
True
# 1.7
# Custom sidebar templates, maps document names to template names.
html_sidebars
=
{}
...
...
doc/gevent.rst
View file @
1c8b1c5a
...
...
@@ -8,8 +8,6 @@ The most common functions and classes are available in the :mod:`gevent` top lev
.. autodata:: __version__
.. autodata:: version_info
Greenlet objects
================
...
...
src/gevent/_greenlet.pxd
View file @
1c8b1c5a
...
...
@@ -60,6 +60,7 @@ cdef class FailureSpawnedLink(SpawnedLink):
@
cython
.
final
@
cython
.
internal
@
cython
.
freelist
(
1000
)
cdef
class
_Frame
:
cdef
readonly
CodeType
f_code
cdef
readonly
int
f_lineno
...
...
@@ -77,7 +78,8 @@ cdef _Frame _Frame_from_list(list frames)
cdef
class
Greenlet
(
greenlet
):
cdef
readonly
object
value
cdef
readonly
args
cdef
readonly
tuple
args
cdef
readonly
dict
kwargs
cdef
readonly
object
spawning_greenlet
cdef
public
dict
spawn_tree_locals
...
...
@@ -89,7 +91,6 @@ cdef class Greenlet(greenlet):
cdef
tuple
_exc_info
cdef
object
_notifier
cdef
object
_start_event
cdef
dict
_kwargs
cdef
str
_formatted_info
cdef
object
_ident
...
...
@@ -103,6 +104,7 @@ cdef class Greenlet(greenlet):
@
cython
.
locals
(
reg
=
IdentRegistry
)
cdef
_get_minimal_ident
(
self
)
cdef
bint
__started_but_aborted
(
self
)
cdef
bint
__start_cancelled_by_kill
(
self
)
cdef
bint
__start_pending
(
self
)
...
...
src/gevent/_ssl2.py
View file @
1c8b1c5a
...
...
@@ -25,10 +25,12 @@ from gevent._compat import PYPY
from
gevent._util
import
copy_globals
__implements__
=
[
'SSLSocket'
,
'wrap_socket'
,
'get_server_certificate'
,
'sslwrap_simple'
]
__implements__
=
[
'SSLSocket'
,
'wrap_socket'
,
'get_server_certificate'
,
'sslwrap_simple'
,
]
# Import all symbols from Python's ssl.py, except those that we are implementing
# and "private" symbols.
...
...
src/gevent/greenlet.py
View file @
1c8b1c5a
...
...
@@ -104,10 +104,10 @@ class _Frame(object):
__slots__
=
(
'f_code'
,
'f_lineno'
,
'f_back'
)
def
__init__
(
self
,
f_code
,
f_lineno
):
def
__init__
(
self
,
f_code
,
f_lineno
,
f_back
):
self
.
f_code
=
f_code
self
.
f_lineno
=
f_lineno
self
.
f_back
=
None
self
.
f_back
=
f_back
@
property
def
f_globals
(
self
):
...
...
@@ -116,8 +116,7 @@ class _Frame(object):
def
_Frame_from_list
(
frames
):
previous
=
None
for
frame
in
reversed
(
frames
):
f
=
_Frame
(
*
frame
)
f
.
f_back
=
previous
f
=
_Frame
(
frame
[
0
],
frame
[
1
],
previous
)
previous
=
f
return
previous
...
...
@@ -146,11 +145,9 @@ class Greenlet(greenlet):
# pylint:disable=keyword-arg-before-vararg,super-init-not-called
def
__init__
(
self
,
run
=
None
,
*
args
,
**
kwargs
):
"""
Greenlet(run=None, *args, **kwargs) -> Greenlet
:param args: The arguments passed to the ``run`` function.
:param kwargs: The keyword arguments passed to the ``run`` function.
:keyword run: The callable object to run. If not given, this object's
:keyword
callable
run: The callable object to run. If not given, this object's
`_run` method will be invoked (typically defined by subclasses).
.. versionchanged:: 1.1b1
...
...
@@ -163,11 +160,11 @@ class Greenlet(greenlet):
.. attribute:: value
Holds the value returned by the function if the greenlet has
finished successfully. Until then, or if it finished in error, `
`None`
`.
finished successfully. Until then, or if it finished in error, `
None
`.
.. tip:: Recall that a greenlet killed with the default
:class:`GreenletExit` is considered to have finished
successfully, and the `
`GreenletExit`
` exception will be
successfully, and the `
GreenletExit
` exception will be
its value.
...
...
@@ -203,7 +200,7 @@ class Greenlet(greenlet):
A class attribute specifying how many levels of the spawning
stack will be kept. Specify a smaller number for higher performance,
specify a larger value for improved debugging.
sp
awning greenlets, sp
ecify a larger value for improved debugging.
.. versionadded:: 1.3a2
"""
...
...
@@ -246,6 +243,10 @@ class Greenlet(greenlet):
if
not
callable
(
self
.
_run
):
raise
TypeError
(
"The run argument or self._run must be callable"
)
self
.
args
=
args
self
.
kwargs
=
kwargs
self
.
value
=
None
#: An event, such as a timer or a callback that fires. It is established in
#: start() and start_later() as those two objects, respectively.
#: Once this becomes non-None, the Greenlet cannot be started again. Conversely,
...
...
@@ -253,9 +254,7 @@ class Greenlet(greenlet):
#: scheduled for starting. A placeholder _dummy_event is assigned by them to prevent
#: the greenlet from being started in the future, if necessary.
self
.
_start_event
=
None
self
.
args
=
args
self
.
_kwargs
=
kwargs
self
.
value
=
None
self
.
_notifier
=
None
self
.
_formatted_info
=
None
self
.
_links
=
[]
...
...
@@ -313,10 +312,6 @@ class Greenlet(greenlet):
self
.
_ident
=
self
.
_get_minimal_ident
()
return
self
.
_ident
@
property
def
kwargs
(
self
):
return
self
.
_kwargs
or
{}
def
_raise_exception
(
self
):
reraise
(
*
self
.
exc_info
)
...
...
@@ -460,8 +455,8 @@ class Greenlet(greenlet):
args
=
[]
if
self
.
args
:
args
=
[
repr
(
x
)[:
50
]
for
x
in
self
.
args
]
if
self
.
_
kwargs
:
args
.
extend
([
'%s=%s'
%
(
key
,
repr
(
value
)[:
50
])
for
(
key
,
value
)
in
self
.
_
kwargs
.
items
()])
if
self
.
kwargs
:
args
.
extend
([
'%s=%s'
%
(
key
,
repr
(
value
)[:
50
])
for
(
key
,
value
)
in
self
.
kwargs
.
items
()])
if
args
:
result
+=
'('
+
', '
.
join
(
args
)
+
')'
# it is important to save the result here, because once the greenlet exits '_run' attribute will be removed
...
...
@@ -724,14 +719,17 @@ class Greenlet(greenlet):
finally
:
self
.
__dict__
.
pop
(
'_run'
,
None
)
self
.
args
=
()
self
.
_kwargs
=
None
self
.
kwargs
.
clear
()
def
_run
(
self
):
"""Subclasses may override this method to take any number of arguments and keyword arguments.
"""
Subclasses may override this method to take any number of
arguments and keyword arguments.
.. versionadded:: 1.1a3
Previously, if no callable object was passed to the constructor, the spawned greenlet would
later fail with an AttributeError.
Previously, if no callable object was
passed to the constructor, the spawned greenlet would later
fail with an AttributeError.
"""
# We usually override this in __init__
# pylint: disable=method-hidden
...
...
@@ -741,9 +739,12 @@ class Greenlet(greenlet):
return
len
(
self
.
_links
)
def
rawlink
(
self
,
callback
):
"""Register a callable to be executed when the greenlet finishes execution.
"""
Register a callable to be executed when the greenlet finishes
execution.
The *callback* will be called with this instance as an argument.
The *callback* will be called with this instance as an
argument.
.. caution:: The callable will be called in the HUB greenlet.
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment