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
71dd770e
Commit
71dd770e
authored
Feb 27, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update comments and docs. [skip ci]
parent
ac39a06a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
22 deletions
+38
-22
changelog.rst
changelog.rst
+9
-8
gevent/__init__.py
gevent/__init__.py
+2
-2
gevent/_socket2.py
gevent/_socket2.py
+6
-3
gevent/_socket3.py
gevent/_socket3.py
+14
-4
greentest/test_threading_2.py
greentest/test_threading_2.py
+7
-5
No files found.
changelog.rst
View file @
71dd770e
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
.. currentmodule:: gevent
.. currentmodule:: gevent
1.1
rc6
(unreleased)
1.1
.0
(unreleased)
===================
===================
- Python 3: A monkey-patched :class:`threading.RLock` now properly
- Python 3: A monkey-patched :class:`threading.RLock` now properly
...
@@ -13,15 +13,16 @@
...
@@ -13,15 +13,16 @@
None). The ``acquire`` method also raises the same :exc:`ValueError`
None). The ``acquire`` method also raises the same :exc:`ValueError`
exceptions that the standard library does for invalid parameters.
exceptions that the standard library does for invalid parameters.
Reported in :issue:`750` by Joy Zheng.
Reported in :issue:`750` by Joy Zheng.
- Fix a race condition in :class:`~gevent.event.Event` that
- Fix a race condition in :class:`~gevent.event.Event` that made it
made it return ``False`` when the event was set and cleared by the
return ``False`` when the event was set and cleared by the same
same greenlet before allowing a switch to the waiting greenlets.
greenlet before allowing a switch to already waiting greenlets. (Found
(Found by the 3.4 and 3.5 standard library test suites; the same as
by the 3.4 and 3.5 standard library test suites; the same as Python
Python `bug 13502`_).
`bug 13502`_. Note that the Python 2 standard library still has this
race condition.)
- :class:`~gevent.event.Event` and :class:`~.AsyncResult` now wake
- :class:`~gevent.event.Event` and :class:`~.AsyncResult` now wake
waiting greenlets in the same (unspecified) order. Previously,
waiting greenlets in the same (unspecified) order. Previously,
``AsyncResult`` tended to use a FIFO order, but this was never
``AsyncResult`` tended to use a FIFO order, but this was never
guaranteed.
guaranteed.
Both classes also use less per-instance memory.
.. _bug 13502: http://bugs.python.org/issue13502
.. _bug 13502: http://bugs.python.org/issue13502
...
@@ -55,7 +56,7 @@
...
@@ -55,7 +56,7 @@
each request, reducing overhead.
each request, reducing overhead.
- Python 2: Under 2.7.9 and above (or when the PEP 466 SSL interfaces
- Python 2: Under 2.7.9 and above (or when the PEP 466 SSL interfaces
are available), perform the same hostname validation that the
are available), perform the same hostname validation that the
standard library does; previously
some cases were ignor
ed. Also,
standard library does; previously
this was skipp
ed. Also,
reading, writing, or handshaking a closed
reading, writing, or handshaking a closed
:class:`~ssl.SSLSocket` now raises the same :exc:`ValueError`
:class:`~ssl.SSLSocket` now raises the same :exc:`ValueError`
the standard library does, instead of an :exc:`AttributeError`.
the standard library does, instead of an :exc:`AttributeError`.
...
...
gevent/__init__.py
View file @
71dd770e
...
@@ -15,10 +15,10 @@ _version_info = namedtuple('version_info',
...
@@ -15,10 +15,10 @@ _version_info = namedtuple('version_info',
#: The programatic version identifier. The fields have (roughly) the
#: The programatic version identifier. The fields have (roughly) the
#: same meaning as :data:`sys.version_info`
#: same meaning as :data:`sys.version_info`
version_info
=
_version_info
(
1
,
1
,
0
,
'
rc'
,
'6'
)
version_info
=
_version_info
(
1
,
1
,
0
,
'
final'
,
0
)
#: The human-readable PEP 440 version identifier
#: The human-readable PEP 440 version identifier
__version__
=
'1.1
rc6
.dev0'
__version__
=
'1.1
.0
.dev0'
__all__
=
[
'get_hub'
,
__all__
=
[
'get_hub'
,
...
...
gevent/_socket2.py
View file @
71dd770e
...
@@ -91,6 +91,9 @@ timeout_default = object()
...
@@ -91,6 +91,9 @@ timeout_default = object()
class
socket
(
object
):
class
socket
(
object
):
"""
gevent socket object.
"""
def
__init__
(
self
,
family
=
AF_INET
,
type
=
SOCK_STREAM
,
proto
=
0
,
_sock
=
None
):
def
__init__
(
self
,
family
=
AF_INET
,
type
=
SOCK_STREAM
,
proto
=
0
,
_sock
=
None
):
if
_sock
is
None
:
if
_sock
is
None
:
...
@@ -456,10 +459,10 @@ class socket(object):
...
@@ -456,10 +459,10 @@ class socket(object):
# delegate the functions that we haven't implemented to the real socket object
# delegate the functions that we haven't implemented to the real socket object
_s
=
(
"def %s(self, *args): return self._sock.%s(*args)
\
n
\
n
"
_s
=
"def %s(self, *args): return self._sock.%s(*args)
\
n
\
n
"
"%s.__doc__ = _realsocket.%s.__doc__
\
n
"
)
for
_m
in
set
(
_socketmethods
)
-
set
(
locals
()):
for
_m
in
set
(
_socketmethods
)
-
set
(
locals
()):
exec
(
_s
%
(
_m
,
_m
,
_m
,
_m
))
exec
(
_s
%
(
_m
,
_m
,))
del
_m
,
_s
del
_m
,
_s
if
PYPY
:
if
PYPY
:
...
...
gevent/_socket3.py
View file @
71dd770e
...
@@ -51,6 +51,9 @@ _closedsocket.close()
...
@@ -51,6 +51,9 @@ _closedsocket.close()
class
socket
(
object
):
class
socket
(
object
):
"""
gevent socket object.
"""
_gevent_sock_class
=
_wrefsocket
_gevent_sock_class
=
_wrefsocket
...
@@ -175,12 +178,13 @@ class socket(object):
...
@@ -175,12 +178,13 @@ class socket(object):
def
makefile
(
self
,
mode
=
"r"
,
buffering
=
None
,
*
,
def
makefile
(
self
,
mode
=
"r"
,
buffering
=
None
,
*
,
encoding
=
None
,
errors
=
None
,
newline
=
None
):
encoding
=
None
,
errors
=
None
,
newline
=
None
):
"""
makefile(...) ->
an I/O stream connected to the socket
"""
Return
an I/O stream connected to the socket
The arguments are as for io.open() after the filename,
The arguments are as for io.open() after the filename,
except the only mode characters supported are 'r', 'w' and 'b'.
except the only mode characters supported are 'r', 'w' and 'b'.
The semantics are similar too.
(XXX refactor to share code?)
The semantics are similar too.
"""
"""
# (XXX refactor to share code?)
for
c
in
mode
:
for
c
in
mode
:
if
c
not
in
{
"r"
,
"w"
,
"b"
}:
if
c
not
in
{
"r"
,
"w"
,
"b"
}:
raise
ValueError
(
"invalid mode %r (only r, w, b allowed)"
)
raise
ValueError
(
"invalid mode %r (only r, w, b allowed)"
)
...
@@ -480,6 +484,10 @@ class socket(object):
...
@@ -480,6 +484,10 @@ class socket(object):
bytes which were sent.
bytes which were sent.
The socket must be of SOCK_STREAM type.
The socket must be of SOCK_STREAM type.
Non-blocking sockets are not supported.
Non-blocking sockets are not supported.
.. versionadded:: 1.1rc4
Added in Python 3.5, but available under all Python 3 versions in
gevent.
"""
"""
return
self
.
_sendfile_use_send
(
file
,
offset
,
count
)
return
self
.
_sendfile_use_send
(
file
,
offset
,
count
)
...
@@ -497,8 +505,10 @@ class socket(object):
...
@@ -497,8 +505,10 @@ class socket(object):
def
set_inheritable
(
self
,
inheritable
):
def
set_inheritable
(
self
,
inheritable
):
os
.
set_inheritable
(
self
.
fileno
(),
inheritable
)
os
.
set_inheritable
(
self
.
fileno
(),
inheritable
)
get_inheritable
.
__doc__
=
"Get the inheritable flag of the socket"
_added
=
"
\
n
\
n
.. versionadded:: 1.1rc4 Added in Python 3.4"
set_inheritable
.
__doc__
=
"Set the inheritable flag of the socket"
get_inheritable
.
__doc__
=
"Get the inheritable flag of the socket"
+
_added
set_inheritable
.
__doc__
=
"Set the inheritable flag of the socket"
+
_added
del
_added
if
sys
.
version_info
[:
2
]
==
(
3
,
4
)
and
sys
.
version_info
[:
3
]
<=
(
3
,
4
,
2
):
if
sys
.
version_info
[:
2
]
==
(
3
,
4
)
and
sys
.
version_info
[:
3
]
<=
(
3
,
4
,
2
):
...
...
greentest/test_threading_2.py
View file @
71dd770e
...
@@ -9,10 +9,12 @@ from gevent.thread import allocate_lock as Lock
...
@@ -9,10 +9,12 @@ from gevent.thread import allocate_lock as Lock
import threading
import threading
threading.Event = Event
threading.Event = Event
threading.Lock = Lock
threading.Lock = Lock
#
XXX
: We're completely patching around the allocate_lock
#
NOTE
: We're completely patching around the allocate_lock
# patch we try to do with RLock; our monkey patch doesn't
# patch we try to do with RLock; our monkey patch doesn't
# behave this way, why do we do it in tests? Save it so we can
# behave this way, but we do it in tests to make sure that
# at least access it sometimes.
# our RLock implementation behaves correctly by itself.
# However, we must test the patched version too, so make it
# available.
threading.NativeRLock = threading.RLock
threading.NativeRLock = threading.RLock
threading.RLock = RLock
threading.RLock = RLock
threading.Semaphore = Semaphore
threading.Semaphore = Semaphore
...
@@ -528,8 +530,8 @@ class RLockTests(lock_tests.RLockTests):
...
@@ -528,8 +530,8 @@ class RLockTests(lock_tests.RLockTests):
locktype
=
staticmethod
(
threading
.
RLock
)
locktype
=
staticmethod
(
threading
.
RLock
)
class
NativeRLockTests
(
lock_tests
.
RLockTests
):
class
NativeRLockTests
(
lock_tests
.
RLockTests
):
#
XXX:
See comments at the top of the file for the difference
# See comments at the top of the file for the difference
# between this and RLockTests, and why
its weird.
# between this and RLockTests, and why
they both matter
locktype
=
staticmethod
(
threading
.
NativeRLock
)
locktype
=
staticmethod
(
threading
.
NativeRLock
)
class
EventTests
(
lock_tests
.
EventTests
):
class
EventTests
(
lock_tests
.
EventTests
):
...
...
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