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
cb1a86f1
Commit
cb1a86f1
authored
Oct 10, 2014
by
Terry Jan Reedy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21986: Idle now matches interpreter in not pickling user code objects.
Patch by Claudiu Popa
parent
b57a7312
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
Lib/idlelib/rpc.py
Lib/idlelib/rpc.py
+10
-10
No files found.
Lib/idlelib/rpc.py
View file @
cb1a86f1
...
...
@@ -29,6 +29,7 @@ accomplished in Idle.
import
sys
import
os
import
io
import
socket
import
select
import
socketserver
...
...
@@ -53,16 +54,15 @@ def pickle_code(co):
ms
=
marshal
.
dumps
(
co
)
return
unpickle_code
,
(
ms
,)
# XXX KBK 24Aug02 function pickling capability not used in Idle
# def unpickle_function(ms):
# return ms
def
dumps
(
obj
,
protocol
=
None
):
f
=
io
.
BytesIO
()
p
=
CodePickler
(
f
,
protocol
)
p
.
dump
(
obj
)
return
f
.
getvalue
()
# def pickle_function(fn):
# assert isinstance(fn, type.FunctionType)
# return repr(fn)
copyreg
.
pickle
(
types
.
CodeType
,
pickle_code
,
unpickle_code
)
# copyreg.pickle(types.FunctionType, pickle_function, unpickle_function)
class
CodePickler
(
pickle
.
Pickler
):
dispatch_table
=
{
types
.
CodeType
:
pickle_code
}
dispatch_table
.
update
(
copyreg
.
dispatch_table
)
BUFSIZE
=
8
*
1024
LOCALHOST
=
'127.0.0.1'
...
...
@@ -329,7 +329,7 @@ class SocketIO(object):
def
putmessage
(
self
,
message
):
self
.
debug
(
"putmessage:%d:"
%
message
[
0
])
try
:
s
=
pickle
.
dumps
(
message
)
s
=
dumps
(
message
)
except
pickle
.
PicklingError
:
print
(
"Cannot pickle:"
,
repr
(
message
),
file
=
sys
.
__stderr__
)
raise
...
...
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