Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
0dd32e24
Kaydet (Commit)
0dd32e24
authored
Nis 11, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Real pickling for bytes.
Restore complex pickling. Use cPickle in io.py.
üst
0ad0812e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
6 deletions
+29
-6
copy_reg.py
Lib/copy_reg.py
+10
-4
io.py
Lib/io.py
+5
-1
bytesobject.c
Objects/bytesobject.c
+14
-1
No files found.
Lib/copy_reg.py
Dosyayı görüntüle @
0dd32e24
...
...
@@ -23,12 +23,18 @@ def constructor(object):
if
not
callable
(
object
):
raise
TypeError
(
"constructors must be callable"
)
# Example: provide pickling support for
bytes object
s.
# Example: provide pickling support for
complex number
s.
def
_pickle_bytes
(
b
):
return
bytes
,
(
str
(
b
),)
try
:
complex
except
NameError
:
pass
else
:
pickle
(
bytes
,
_pickle_bytes
)
def
pickle_complex
(
c
):
return
complex
,
(
c
.
real
,
c
.
imag
)
pickle
(
complex
,
pickle_complex
,
complex
)
# Support for pickling new-style objects
...
...
Lib/io.py
Dosyayı görüntüle @
0dd32e24
...
...
@@ -30,10 +30,14 @@ __all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO",
import
os
import
sys
import
codecs
import
pickle
import
_fileio
import
warnings
try
:
import
cPickle
as
pickle
except
ImportError
:
import
pickle
# XXX Shouldn't we use st_blksize whenever we can?
DEFAULT_BUFFER_SIZE
=
8
*
1024
# bytes
...
...
Objects/bytesobject.c
Dosyayı görüntüle @
0dd32e24
...
...
@@ -2598,6 +2598,17 @@ bytes_fromhex(PyObject *cls, PyObject *args)
return
NULL
;
}
PyDoc_STRVAR
(
reduce_doc
,
"Return state information for pickling."
);
static
PyObject
*
bytes_reduce
(
PyBytesObject
*
self
)
{
return
Py_BuildValue
(
"(O(s#))"
,
self
->
ob_type
,
self
->
ob_bytes
==
NULL
?
""
:
self
->
ob_bytes
,
self
->
ob_size
);
}
static
PySequenceMethods
bytes_as_sequence
=
{
(
lenfunc
)
bytes_length
,
/* sq_length */
(
binaryfunc
)
bytes_concat
,
/* sq_concat */
...
...
@@ -2650,8 +2661,10 @@ bytes_methods[] = {
{
"remove"
,
(
PyCFunction
)
bytes_remove
,
METH_O
,
remove__doc__
},
{
"decode"
,
(
PyCFunction
)
bytes_decode
,
METH_VARARGS
,
decode_doc
},
{
"__alloc__"
,
(
PyCFunction
)
bytes_alloc
,
METH_NOARGS
,
alloc_doc
},
{
"fromhex"
,
(
PyCFunction
)
bytes_fromhex
,
METH_VARARGS
|
METH_CLASS
,
fromhex_doc
},
{
"fromhex"
,
(
PyCFunction
)
bytes_fromhex
,
METH_VARARGS
|
METH_CLASS
,
fromhex_doc
},
{
"join"
,
(
PyCFunction
)
bytes_join
,
METH_O
|
METH_CLASS
,
join_doc
},
{
"__reduce__"
,
(
PyCFunction
)
bytes_reduce
,
METH_NOARGS
,
reduce_doc
},
{
NULL
}
};
...
...
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