Skip to content

Commit eef9b0e

Browse files
author
Anselm Kruis
committed
Issue python#112: Prepare Stackless 3.5
- Skip the CPython test case test.test_pickle.*.test_local_lookup_error. This test checks, that pickling of a local function raises an exception. Stackless pickles the function by value. https://bitbucket.org/stackless-dev/stackless/issues/112
1 parent d369502 commit eef9b0e

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Lib/test/pickletester.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,12 @@ def create_dynamic_class(name, bases):
403403
DATA4 = b'\x80\x02c__builtin__\nxrange\nq\x00K\x00K\x05K\x01\x87q\x01Rq\x02.'
404404
try:
405405
import stackless
406+
has_stackless = True
406407
DATA4_SLP = b'\x80\x02cstackless._wrap\nrange\nq\x00K\x00K\x05K\x01\x87q\x01Rq\x02)b.'
407-
except:
408+
except ImportError:
409+
has_stackless = False
408410
DATA4_SLP = DATA4
409-
411+
410412

411413
# a SimpleCookie() object pickled from 2.x with protocol 2
412414
DATA5 = (b'\x80\x02cCookie\nSimpleCookie\nq\x00)\x81q\x01U\x03key'
@@ -1332,12 +1334,9 @@ def test_unpickle_from_2x(self):
13321334
loaded = self.loads(DATA3)
13331335
self.assertEqual(loaded, set([1, 2]))
13341336
loaded = self.loads(DATA4_SLP)
1335-
try:
1336-
import stackless
1337-
except ImportError:
1337+
if not has_stackless:
1338+
# stackless provides a fake range for unpickling
13381339
self.assertEqual(type(loaded), type(range(0)))
1339-
else:
1340-
pass # stackless provides a fake range for unpickling
13411340
self.assertEqual(list(loaded), list(range(5)))
13421341
loaded = self.loads(DATA5)
13431342
self.assertEqual(type(loaded), SimpleCookie)
@@ -1705,6 +1704,8 @@ class Nested(str):
17051704
def test_local_lookup_error(self):
17061705
# Test that whichmodule() errors out cleanly when looking up
17071706
# an assumed globally-reachable object fails.
1707+
if has_stackless:
1708+
self.skipTest("Stackless can pickle functions by value")
17081709
def f():
17091710
pass
17101711
# Since the function is local, lookup will fail

Stackless/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ What's New in Stackless 3.X.X?
1212
- https://bitbucket.org/stackless-dev/stackless/issues/112
1313
Adapt Stackless to Python 3.5.
1414
- PyGenObject got two additional fields
15+
- Skip the CPython test case test.test_pickle.*.test_local_lookup_error
1516

1617
- https://bitbucket.org/stackless-dev/stackless/issues/111
1718
Restore the Python ABI function PyGen_New(). Previously Stackless named this

0 commit comments

Comments
 (0)