Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c57e6e2e
Commit
c57e6e2e
authored
Nov 27, 2018
by
Anthony Sottile
Committed by
Serhiy Storchaka
Nov 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-35312: Make lib2to3.pgen2.parse.ParseError round-trip pickle-able. (GH-10710)
parent
d4f9cf55
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
+16
-0
Lib/lib2to3/pgen2/parse.py
Lib/lib2to3/pgen2/parse.py
+3
-0
Lib/lib2to3/tests/test_parser.py
Lib/lib2to3/tests/test_parser.py
+12
-0
Misc/NEWS.d/next/Library/2018-11-25-20-05-33.bpo-35312.wbw0zO.rst
...S.d/next/Library/2018-11-25-20-05-33.bpo-35312.wbw0zO.rst
+1
-0
No files found.
Lib/lib2to3/pgen2/parse.py
View file @
c57e6e2e
...
@@ -24,6 +24,9 @@ class ParseError(Exception):
...
@@ -24,6 +24,9 @@ class ParseError(Exception):
self
.
value
=
value
self
.
value
=
value
self
.
context
=
context
self
.
context
=
context
def
__reduce__
(
self
):
return
type
(
self
),
(
self
.
msg
,
self
.
type
,
self
.
value
,
self
.
context
)
class
Parser
(
object
):
class
Parser
(
object
):
"""Parser engine.
"""Parser engine.
...
...
Lib/lib2to3/tests/test_parser.py
View file @
c57e6e2e
...
@@ -622,6 +622,18 @@ class TestLiterals(GrammarTest):
...
@@ -622,6 +622,18 @@ class TestLiterals(GrammarTest):
self
.
validate
(
s
)
self
.
validate
(
s
)
class
TestPickleableException
(
unittest
.
TestCase
):
def
test_ParseError
(
self
):
err
=
ParseError
(
'msg'
,
2
,
None
,
(
1
,
'context'
))
for
proto
in
range
(
pickle
.
HIGHEST_PROTOCOL
+
1
):
err2
=
pickle
.
loads
(
pickle
.
dumps
(
err
,
protocol
=
proto
))
self
.
assertEqual
(
err
.
args
,
err2
.
args
)
self
.
assertEqual
(
err
.
msg
,
err2
.
msg
)
self
.
assertEqual
(
err
.
type
,
err2
.
type
)
self
.
assertEqual
(
err
.
value
,
err2
.
value
)
self
.
assertEqual
(
err
.
context
,
err2
.
context
)
def
diff_texts
(
a
,
b
,
filename
):
def
diff_texts
(
a
,
b
,
filename
):
a
=
a
.
splitlines
()
a
=
a
.
splitlines
()
b
=
b
.
splitlines
()
b
=
b
.
splitlines
()
...
...
Misc/NEWS.d/next/Library/2018-11-25-20-05-33.bpo-35312.wbw0zO.rst
0 → 100644
View file @
c57e6e2e
Make ``lib2to3.pgen2.parse.ParseError`` round-trip pickle-able. Patch by Anthony Sottile.
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