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
cc74b6ab
Kaydet (Commit)
cc74b6ab
authored
Nis 10, 2012
tarafından
Stefan Krah
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #14478: Cache the hash of a Decimal in the C version.
üst
9deb1887
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
_decimal.c
Modules/_decimal/_decimal.c
+14
-1
No files found.
Modules/_decimal/_decimal.c
Dosyayı görüntüle @
cc74b6ab
...
...
@@ -60,6 +60,7 @@
typedef
struct
{
PyObject_HEAD
Py_hash_t
hash
;
mpd_t
dec
;
mpd_uint_t
data
[
_Py_DEC_MINALLOC
];
}
PyDecObject
;
...
...
@@ -1805,6 +1806,8 @@ PyDecType_New(PyTypeObject *type)
return
NULL
;
}
dec
->
hash
=
-
1
;
MPD
(
dec
)
->
flags
=
MPD_STATIC
|
MPD_STATIC_DATA
;
MPD
(
dec
)
->
exp
=
0
;
MPD
(
dec
)
->
digits
=
0
;
...
...
@@ -4210,7 +4213,7 @@ dec_floor(PyObject *self, PyObject *dummy UNUSED)
/* Always uses the module context */
static
Py_hash_t
dec_hash
(
Py
Object
*
v
)
_dec_hash
(
PyDec
Object
*
v
)
{
#if defined(CONFIG_64) && _PyHASH_BITS == 61
/* 2**61 - 1 */
...
...
@@ -4323,6 +4326,16 @@ malloc_error:
goto
finish
;
}
static
Py_hash_t
dec_hash
(
PyDecObject
*
self
)
{
if
(
self
->
hash
==
-
1
)
{
self
->
hash
=
_dec_hash
(
self
);
}
return
self
->
hash
;
}
/* __reduce__ */
static
PyObject
*
dec_reduce
(
PyObject
*
self
,
PyObject
*
dummy
UNUSED
)
...
...
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