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
b86561ba
Commit
b86561ba
authored
Mar 02, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests on Python 3.4: It doesn't have SSLObject.
parent
4324fad0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
+23
-15
src/gevent/_ssl3.py
src/gevent/_ssl3.py
+17
-11
src/greentest/test__local.py
src/greentest/test__local.py
+6
-4
No files found.
src/gevent/_ssl3.py
View file @
b86561ba
...
@@ -137,17 +137,23 @@ class _contextawaresock(socket._gevent_sock_class): # Python 2: pylint:disable=s
...
@@ -137,17 +137,23 @@ class _contextawaresock(socket._gevent_sock_class): # Python 2: pylint:disable=s
pass
pass
raise
AttributeError
(
name
)
raise
AttributeError
(
name
)
_SSLObject_factory
=
SSLObject
try
:
if
hasattr
(
SSLObject
,
'_create'
):
_SSLObject_factory
=
SSLObject
# 3.7 is making thing difficult and won't let you
except
NameError
:
# actually construct an object
# 3.4 and below do not have SSLObject, something
def
_SSLObject_factory
(
sslobj
,
owner
=
None
,
session
=
None
):
# we magically import through copy_globals
s
=
SSLObject
.
__new__
(
SSLObject
)
pass
s
.
_sslobj
=
sslobj
else
:
s
.
_sslobj
.
owner
=
owner
or
s
if
hasattr
(
SSLObject
,
'_create'
):
if
session
is
not
None
:
# 3.7 is making thing difficult and won't let you
s
.
_sslobj
.
session
=
session
# actually construct an object
return
s
def
_SSLObject_factory
(
sslobj
,
owner
=
None
,
session
=
None
):
s
=
SSLObject
.
__new__
(
SSLObject
)
s
.
_sslobj
=
sslobj
s
.
_sslobj
.
owner
=
owner
or
s
if
session
is
not
None
:
s
.
_sslobj
.
session
=
session
return
s
class
SSLSocket
(
socket
):
class
SSLSocket
(
socket
):
"""
"""
...
...
src/greentest/test__local.py
View file @
b86561ba
...
@@ -274,7 +274,10 @@ class TestGeventLocal(greentest.TestCase):
...
@@ -274,7 +274,10 @@ class TestGeventLocal(greentest.TestCase):
# The sentinels should be gone too
# The sentinels should be gone too
self
.
assertEqual
(
len
(
deleted_sentinels
),
len
(
greenlets
))
self
.
assertEqual
(
len
(
deleted_sentinels
),
len
(
greenlets
))
@
greentest
.
skipOnLibuvOnPyPyOnWin
(
"GC makes this non-deterministic, especially on Windows"
)
def
test_locals_collected_when_unreferenced_even_in_running_greenlet
(
self
):
def
test_locals_collected_when_unreferenced_even_in_running_greenlet
(
self
):
# In fact only on Windows do we see GC being an issue;
# pypy2 5.0 on macos and travis don't have a problem.
# https://github.com/gevent/gevent/issues/981
# https://github.com/gevent/gevent/issues/981
import
gevent
import
gevent
import
gc
import
gc
...
@@ -308,17 +311,16 @@ class TestGeventLocal(greentest.TestCase):
...
@@ -308,17 +311,16 @@ class TestGeventLocal(greentest.TestCase):
self
.
assertEqual
(
count
,
len
(
deleted_sentinels
))
self
.
assertEqual
(
count
,
len
(
deleted_sentinels
))
@
greentest
.
skipOnPyPy
(
"GC makes this non-deterministic, especially on Windows"
)
def
test_local_dicts_for_greenlet
(
self
):
def
test_local_dicts_for_greenlet
(
self
):
# In fact, only on Windows do we see gc being an issue;
# pypy2 5.10 on macOS and Travis don't have a problem.
import
gevent
import
gevent
from
gevent.local
import
all_local_dicts_for_greenlet
from
gevent.local
import
all_local_dicts_for_greenlet
x
=
MyLocal
()
x
=
MyLocal
()
x
.
foo
=
42
x
.
foo
=
42
del
x
.
sentinel
del
x
.
sentinel
if
greentest
.
PYPY
:
import
gc
gc
.
collect
()
results
=
all_local_dicts_for_greenlet
(
gevent
.
getcurrent
())
results
=
all_local_dicts_for_greenlet
(
gevent
.
getcurrent
())
self
.
assertEqual
(
results
,
self
.
assertEqual
(
results
,
[((
MyLocal
,
id
(
x
)),
{
'foo'
:
42
})])
[((
MyLocal
,
id
(
x
)),
{
'foo'
:
42
})])
...
...
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