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
f87b85f8
Kaydet (Commit)
f87b85f8
authored
Haz 23, 2017
tarafından
Victor Stinner
Kaydeden (comit)
GitHub
Haz 23, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-21071: struct.Struct.format type is now str (#845)
üst
a4b091e1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
2 deletions
+19
-2
struct.rst
Doc/library/struct.rst
+3
-0
3.7.rst
Doc/whatsnew/3.7.rst
+3
-0
test_struct.py
Lib/test/test_struct.py
+8
-0
NEWS
Misc/NEWS
+3
-0
_struct.c
Modules/_struct.c
+2
-2
No files found.
Doc/library/struct.rst
Dosyayı görüntüle @
f87b85f8
...
@@ -443,6 +443,9 @@ The :mod:`struct` module also defines the following type:
...
@@ -443,6 +443,9 @@ The :mod:`struct` module also defines the following type:
The format string used to construct this Struct object.
The format string used to construct this Struct object.
.. versionchanged:: 3.7
The format string type is now :class:`str` instead of :class:`bytes`.
.. attribute:: size
.. attribute:: size
The calculated size of the struct (and hence of the bytes object produced
The calculated size of the struct (and hence of the bytes object produced
...
...
Doc/whatsnew/3.7.rst
Dosyayı görüntüle @
f87b85f8
...
@@ -429,6 +429,9 @@ Changes in the Python API
...
@@ -429,6 +429,9 @@ Changes in the Python API
``makedirs()``.
``makedirs()``.
(Contributed by Serhiy Storchaka in :issue:`19930`.)
(Contributed by Serhiy Storchaka in :issue:`19930`.)
* The :attr:`struct.Struct.format` type is now :class:`str` instead of
:class:`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)
CPython bytecode changes
CPython bytecode changes
------------------------
------------------------
...
...
Lib/test/test_struct.py
Dosyayı görüntüle @
f87b85f8
...
@@ -618,6 +618,14 @@ class StructTest(unittest.TestCase):
...
@@ -618,6 +618,14 @@ class StructTest(unittest.TestCase):
# Shouldn't crash.
# Shouldn't crash.
self
.
assertEqual
(
struct
.
unpack
(
b
'b'
,
b
'a'
),
(
b
'a'
[
0
],))
self
.
assertEqual
(
struct
.
unpack
(
b
'b'
,
b
'a'
),
(
b
'a'
[
0
],))
def
test_format_attr
(
self
):
s
=
struct
.
Struct
(
'=i2H'
)
self
.
assertEqual
(
s
.
format
,
'=i2H'
)
# use a bytes string
s2
=
struct
.
Struct
(
s
.
format
.
encode
())
self
.
assertEqual
(
s2
.
format
,
s
.
format
)
class
UnpackIteratorTest
(
unittest
.
TestCase
):
class
UnpackIteratorTest
(
unittest
.
TestCase
):
"""
"""
...
...
Misc/NEWS
Dosyayı görüntüle @
f87b85f8
...
@@ -374,6 +374,9 @@ Extension Modules
...
@@ -374,6 +374,9 @@ Extension Modules
Library
Library
-------
-------
- bpo-21071: struct.Struct.format type is now :class:`str` instead of
:class:`bytes`.
- bpo-29212: Fix concurrent.futures.thread.ThreadPoolExecutor threads to have
- bpo-29212: Fix concurrent.futures.thread.ThreadPoolExecutor threads to have
a non repr() based thread name by default when no thread_name_prefix is
a non repr() based thread name by default when no thread_name_prefix is
supplied. They will now identify themselves as "ThreadPoolExecutor-y_n".
supplied. They will now identify themselves as "ThreadPoolExecutor-y_n".
...
...
Modules/_struct.c
Dosyayı görüntüle @
f87b85f8
...
@@ -1957,8 +1957,8 @@ s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames
...
@@ -1957,8 +1957,8 @@ s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames
static
PyObject
*
static
PyObject
*
s_get_format
(
PyStructObject
*
self
,
void
*
unused
)
s_get_format
(
PyStructObject
*
self
,
void
*
unused
)
{
{
Py_INCREF
(
self
->
s_format
);
return
PyUnicode_FromStringAndSize
(
PyBytes_AS_STRING
(
self
->
s_format
),
return
self
->
s_format
;
PyBytes_GET_SIZE
(
self
->
s_format
))
;
}
}
static
PyObject
*
static
PyObject
*
...
...
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