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
4ab701b2
Kaydet (Commit)
4ab701b2
authored
Şub 21, 2012
tarafından
Petri Lehtinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sqlite3: Fix 64-bit integer handling in user functions on 32-bit architectures
Closes #8033.
üst
36b7361f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
5 deletions
+30
-5
userfunctions.py
Lib/sqlite3/test/userfunctions.py
+18
-0
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
connection.c
Modules/_sqlite/connection.c
+8
-5
No files found.
Lib/sqlite3/test/userfunctions.py
Dosyayı görüntüle @
4ab701b2
...
...
@@ -37,6 +37,8 @@ def func_returnnull():
return
None
def
func_returnblob
():
return
buffer
(
"blob"
)
def
func_returnlonglong
():
return
1
<<
31
def
func_raiseexception
():
5
//
0
...
...
@@ -50,6 +52,8 @@ def func_isnone(v):
return
type
(
v
)
is
type
(
None
)
def
func_isblob
(
v
):
return
type
(
v
)
is
buffer
def
func_islonglong
(
v
):
return
isinstance
(
v
,
(
int
,
long
))
and
v
>=
1
<<
31
class
AggrNoStep
:
def
__init__
(
self
):
...
...
@@ -126,6 +130,7 @@ class FunctionTests(unittest.TestCase):
self
.
con
.
create_function
(
"returnfloat"
,
0
,
func_returnfloat
)
self
.
con
.
create_function
(
"returnnull"
,
0
,
func_returnnull
)
self
.
con
.
create_function
(
"returnblob"
,
0
,
func_returnblob
)
self
.
con
.
create_function
(
"returnlonglong"
,
0
,
func_returnlonglong
)
self
.
con
.
create_function
(
"raiseexception"
,
0
,
func_raiseexception
)
self
.
con
.
create_function
(
"isstring"
,
1
,
func_isstring
)
...
...
@@ -133,6 +138,7 @@ class FunctionTests(unittest.TestCase):
self
.
con
.
create_function
(
"isfloat"
,
1
,
func_isfloat
)
self
.
con
.
create_function
(
"isnone"
,
1
,
func_isnone
)
self
.
con
.
create_function
(
"isblob"
,
1
,
func_isblob
)
self
.
con
.
create_function
(
"islonglong"
,
1
,
func_islonglong
)
def
tearDown
(
self
):
self
.
con
.
close
()
...
...
@@ -199,6 +205,12 @@ class FunctionTests(unittest.TestCase):
self
.
assertEqual
(
type
(
val
),
buffer
)
self
.
assertEqual
(
val
,
buffer
(
"blob"
))
def
CheckFuncReturnLongLong
(
self
):
cur
=
self
.
con
.
cursor
()
cur
.
execute
(
"select returnlonglong()"
)
val
=
cur
.
fetchone
()[
0
]
self
.
assertEqual
(
val
,
1
<<
31
)
def
CheckFuncException
(
self
):
cur
=
self
.
con
.
cursor
()
try
:
...
...
@@ -238,6 +250,12 @@ class FunctionTests(unittest.TestCase):
val
=
cur
.
fetchone
()[
0
]
self
.
assertEqual
(
val
,
1
)
def
CheckParamLongLong
(
self
):
cur
=
self
.
con
.
cursor
()
cur
.
execute
(
"select islonglong(?)"
,
(
1
<<
42
,))
val
=
cur
.
fetchone
()[
0
]
self
.
assertEqual
(
val
,
1
)
class
AggregateTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
con
=
sqlite
.
connect
(
":memory:"
)
...
...
Misc/ACKS
Dosyayı görüntüle @
4ab701b2
...
...
@@ -198,6 +198,7 @@ Arnaud Delobelle
Erik Demaine
John Dennis
Roger Dev
Philippe Devalkeneer
Raghuram Devarakonda
Catherine Devlin
Scott Dial
...
...
Misc/NEWS
Dosyayı görüntüle @
4ab701b2
...
...
@@ -98,6 +98,9 @@ Core and Builtins
Library
-------
- Issue #8033: sqlite3: Fix 64-bit integer handling in user functions
on 32-bit architectures. Initial patch by Philippe Devalkeneer.
- HTMLParser is now able to handle slashes in the start tag.
- Issue #14001: CVE-2012-0845: xmlrpc: Fix an endless loop in
...
...
Modules/_sqlite/connection.c
Dosyayı görüntüle @
4ab701b2
...
...
@@ -540,7 +540,6 @@ error:
void
_pysqlite_set_result
(
sqlite3_context
*
context
,
PyObject
*
py_val
)
{
long
longval
;
const
char
*
buffer
;
Py_ssize_t
buflen
;
PyObject
*
stringval
;
...
...
@@ -550,8 +549,9 @@ void _pysqlite_set_result(sqlite3_context* context, PyObject* py_val)
}
else
if
(
py_val
==
Py_None
)
{
sqlite3_result_null
(
context
);
}
else
if
(
PyInt_Check
(
py_val
))
{
longval
=
PyInt_AsLong
(
py_val
);
sqlite3_result_int64
(
context
,
(
PY_LONG_LONG
)
longval
);
sqlite3_result_int64
(
context
,
(
sqlite3_int64
)
PyInt_AsLong
(
py_val
));
}
else
if
(
PyLong_Check
(
py_val
))
{
sqlite3_result_int64
(
context
,
PyLong_AsLongLong
(
py_val
));
}
else
if
(
PyFloat_Check
(
py_val
))
{
sqlite3_result_double
(
context
,
PyFloat_AsDouble
(
py_val
));
}
else
if
(
PyBuffer_Check
(
py_val
))
{
...
...
@@ -580,7 +580,7 @@ PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_
sqlite3_value
*
cur_value
;
PyObject
*
cur_py_value
;
const
char
*
val_str
;
PY_LONG_LONG
val_int
;
sqlite3_int64
val_int
;
Py_ssize_t
buflen
;
void
*
raw_buffer
;
...
...
@@ -594,7 +594,10 @@ PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_
switch
(
sqlite3_value_type
(
argv
[
i
]))
{
case
SQLITE_INTEGER
:
val_int
=
sqlite3_value_int64
(
cur_value
);
cur_py_value
=
PyInt_FromLong
((
long
)
val_int
);
if
(
val_int
<
LONG_MIN
||
val_int
>
LONG_MAX
)
cur_py_value
=
PyLong_FromLongLong
(
val_int
);
else
cur_py_value
=
PyInt_FromLong
((
long
)
val_int
);
break
;
case
SQLITE_FLOAT
:
cur_py_value
=
PyFloat_FromDouble
(
sqlite3_value_double
(
cur_value
));
...
...
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