Author: Ronan Lamy <[email protected]>
Branch: py3.5
Changeset: r93453:cf79d090d371
Date: 2017-12-17 22:07 +0000
http://bitbucket.org/pypy/pypy/changeset/cf79d090d371/
Log: Fix test_gr_frame in test_greenlet.py
diff --git a/lib_pypy/greenlet.py b/lib_pypy/greenlet.py
--- a/lib_pypy/greenlet.py
+++ b/lib_pypy/greenlet.py
@@ -127,7 +127,7 @@
return None
if self.__main:
self = getcurrent()
- f = _continulet.__reduce__(self)[2][0]
+ f = self._get_frame()
if not f:
return None
return f.f_back.f_back.f_back # go past start(), __switch(), switch()
diff --git a/pypy/module/_continuation/interp_continuation.py
b/pypy/module/_continuation/interp_continuation.py
--- a/pypy/module/_continuation/interp_continuation.py
+++ b/pypy/module/_continuation/interp_continuation.py
@@ -131,6 +131,15 @@
from pypy.module._continuation import interp_pickle
interp_pickle.setstate(self, w_args)
+ def descr_get_frame(self, space):
+ if self.sthread is None:
+ w_frame = space.w_False
+ elif self.sthread.is_empty_handle(self.h):
+ w_frame = space.w_None
+ else:
+ w_frame = self.bottomframe
+ return w_frame
+
def W_Continulet___new__(space, w_subtype, __args__):
r = space.allocate_instance(W_Continulet, w_subtype)
@@ -153,6 +162,7 @@
is_pending = interp2app(W_Continulet.descr_is_pending),
__reduce__ = interp2app(W_Continulet.descr__reduce__),
__setstate__= interp2app(W_Continulet.descr__setstate__),
+ _get_frame=interp2app(W_Continulet.descr_get_frame)
)
# ____________________________________________________________
diff --git a/pypy/module/_continuation/interp_pickle.py
b/pypy/module/_continuation/interp_pickle.py
--- a/pypy/module/_continuation/interp_pickle.py
+++ b/pypy/module/_continuation/interp_pickle.py
@@ -18,12 +18,7 @@
# __getnewargs__ or __getstate__ defined in the subclass, etc.
# Doing the right thing looks involved, though...
space = self.space
- if self.sthread is None:
- w_frame = space.w_False
- elif self.sthread.is_empty_handle(self.h):
- w_frame = space.w_None
- else:
- w_frame = self.bottomframe
+ w_frame = self.descr_get_frame(space)
w_continulet_type = space.type(self)
w_dict = self.getdict(space) or space.w_None
args = [getunpickle(space),
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit