Work around weird Python 3.5 generator/iterator interaction

* wrap/python/spot.py: Python 3.5 reports some unexpected SystemError
messages when the stack of iterator(...(iterator(generator))) we build
for random LTL generation raises a StopIteration.  The messages are
attached either to delete_formula or delete_randltlgenerator, claiming
that these functions exit with an error; but I have checked that they
do not.  I've been unable to understand the cause of the issue.
Replacing the generator by an iterator at least fixes the problem in a
way that is transparent for our API.
* wrap/python/tests/randltl.ipynb: Adjust expected formulas.
This commit is contained in:
Alexandre Duret-Lutz 2015-10-02 22:39:57 +02:00
parent 5f2d55ab2e
commit 6ff4fa9722
2 changed files with 49 additions and 26 deletions

View file

@ -1,7 +1,23 @@
{
"metadata": {
"name": "",
"signature": "sha256:54b0c9570ca91322c466f914d622a3723cd3e450612a055a188927bf50dfdaf8"
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3+"
},
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
@ -164,7 +180,7 @@
"output_type": "stream",
"stream": "stdout",
"text": [
"G(p2 U Gp0)\n"
"G(p1 U Gp0)\n"
]
}
],
@ -199,7 +215,7 @@
"output_type": "stream",
"stream": "stdout",
"text": [
"{{p0 && p1}[*]}<>-> (Fp1 & Fp0)\n"
"{{p0 && p2}[*]}<>-> (Fp2 & Fp0)\n"
]
}
],
@ -571,11 +587,11 @@
"stream": "stdout",
"text": [
"0\n",
"!(F!p0 M 1)\n",
"(Gp1 | Fp0) M 1\n",
"F!(!p0 <-> FGp0)\n",
"Gp0 U (p0 U GFp0)\n",
"(!p0 U p0) U ((p1 & (p1 U (!p1 & (!p1 -> Fp0))) & ((!p0 U !p1) | (p0 U !p1))) | (!p1 & (!p1 U (p1 & (!p1 -> Fp0))) & ((!p0 U p1) | (p0 U p1))) | (p0 & (p0 U (!p0 & (!p1 -> Fp0))) & ((!p1 U !p0) | (p1 U !p0))) | (!p0 & (!p0 U (p0 & (!p1 -> Fp0))) & ((!p1 U p0) | (p1 U p0))) | ((!p1 -> Fp0) & (Gp1 | G!p1) & (Gp0 | G!p0)))\n"
"!(F!p1 M 1)\n",
"(Gp0 | Fp1) M 1\n",
"F!(!p1 <-> FGp1)\n",
"Gp1 U (p1 U GFp1)\n",
"(!p1 U p1) U ((p0 & (p0 U (!p0 & (!p0 -> Fp1))) & ((!p1 U !p0) | (p1 U !p0))) | (!p0 & (!p0 U (p0 & (!p0 -> Fp1))) & ((!p1 U p0) | (p1 U p0))) | (p1 & (p1 U (!p1 & (!p0 -> Fp1))) & ((!p0 U !p1) | (p0 U !p1))) | (!p1 & (!p1 U (p1 & (!p0 -> Fp1))) & ((!p0 U p1) | (p0 U p1))) | ((!p0 -> Fp1) & (Gp0 | G!p0) & (Gp1 | G!p1)))\n"
]
}
],