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
ac11e021
Kaydet (Commit)
ac11e021
authored
Kas 05, 2007
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add the bsddb.db.DBEnv.lock_id_free method.
Improve test_lock's tempdir creation and cleanup.
üst
ec10a4a4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
14 deletions
+35
-14
test_lock.py
Lib/bsddb/test/test_lock.py
+12
-14
NEWS
Misc/NEWS
+2
-0
_bsddb.c
Modules/_bsddb.c
+21
-0
No files found.
Lib/bsddb/test/test_lock.py
Dosyayı görüntüle @
ac11e021
...
...
@@ -2,10 +2,12 @@
TestCases for testing the locking sub-system.
"""
import
sys
,
os
,
string
import
os
from
pprint
import
pprint
import
shutil
import
sys
import
tempfile
import
time
from
pprint
import
pprint
try
:
from
threading
import
Thread
,
currentThread
...
...
@@ -30,21 +32,15 @@ except ImportError:
class
LockingTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
homeDir
=
os
.
path
.
join
(
tempfile
.
gettempdir
(),
'db_home'
)
self
.
homeDir
=
homeDir
try
:
os
.
mkdir
(
homeDir
)
except
os
.
error
:
pass
self
.
homeDir
=
tempfile
.
mkdtemp
(
'.test_lock'
)
self
.
env
=
db
.
DBEnv
()
self
.
env
.
open
(
homeDir
,
db
.
DB_THREAD
|
db
.
DB_INIT_MPOOL
|
db
.
DB_INIT_LOCK
|
db
.
DB_CREATE
)
self
.
env
.
open
(
self
.
homeDir
,
db
.
DB_THREAD
|
db
.
DB_INIT_MPOOL
|
db
.
DB_INIT_LOCK
|
db
.
DB_CREATE
)
def
tearDown
(
self
):
self
.
env
.
close
()
import
glob
files
=
glob
.
glob
(
os
.
path
.
join
(
self
.
homeDir
,
'*'
))
for
file
in
files
:
os
.
remove
(
file
)
shutil
.
rmtree
(
self
.
homeDir
)
def
test01_simple
(
self
):
...
...
@@ -62,8 +58,8 @@ class LockingTestCase(unittest.TestCase):
self
.
env
.
lock_put
(
lock
)
if
verbose
:
print
"Released lock:
%
s"
%
lock
if
db
.
version
()
>=
(
4
,
0
):
self
.
env
.
lock_id_free
(
anID
)
def
test02_threaded
(
self
):
...
...
@@ -124,6 +120,8 @@ class LockingTestCase(unittest.TestCase):
self
.
env
.
lock_put
(
lock
)
if
verbose
:
print
"
%
s: Released
%
s lock:
%
s"
%
(
name
,
lt
,
lock
)
if
db
.
version
()
>=
(
4
,
0
):
self
.
env
.
lock_id_free
(
anID
)
#----------------------------------------------------------------------
...
...
Misc/NEWS
Dosyayı görüntüle @
ac11e021
...
...
@@ -830,6 +830,8 @@ Extension Modules
DB
users
should
use
DB
.
put
(
k
,
v
)
when
they
want
to
store
duplicates
;
not
DB
[
k
]
=
v
.
-
Add
the
bsddb
.
db
.
DBEnv
.
lock_id_free
method
.
-
Bug
#
1686475
:
Support
stat
'ing open files on Windows again.
- Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
...
...
Modules/_bsddb.c
Dosyayı görüntüle @
ac11e021
...
...
@@ -4250,6 +4250,24 @@ DBEnv_lock_id(DBEnvObject* self, PyObject* args)
return
PyInt_FromLong
((
long
)
theID
);
}
#if (DBVER >= 40)
static
PyObject
*
DBEnv_lock_id_free
(
DBEnvObject
*
self
,
PyObject
*
args
)
{
int
err
;
u_int32_t
theID
;
if
(
!
PyArg_ParseTuple
(
args
,
"I:lock_id_free"
,
&
theID
))
return
NULL
;
CHECK_ENV_NOT_CLOSED
(
self
);
MYDB_BEGIN_ALLOW_THREADS
;
err
=
self
->
db_env
->
lock_id_free
(
self
->
db_env
,
theID
);
MYDB_END_ALLOW_THREADS
;
RETURN_IF_ERR
();
RETURN_NONE
();
}
#endif
static
PyObject
*
DBEnv_lock_put
(
DBEnvObject
*
self
,
PyObject
*
args
)
...
...
@@ -5125,6 +5143,9 @@ static PyMethodDef DBEnv_methods[] = {
{
"lock_detect"
,
(
PyCFunction
)
DBEnv_lock_detect
,
METH_VARARGS
},
{
"lock_get"
,
(
PyCFunction
)
DBEnv_lock_get
,
METH_VARARGS
},
{
"lock_id"
,
(
PyCFunction
)
DBEnv_lock_id
,
METH_VARARGS
},
#if (DBVER >= 40)
{
"lock_id_free"
,
(
PyCFunction
)
DBEnv_lock_id_free
,
METH_VARARGS
},
#endif
{
"lock_put"
,
(
PyCFunction
)
DBEnv_lock_put
,
METH_VARARGS
},
{
"lock_stat"
,
(
PyCFunction
)
DBEnv_lock_stat
,
METH_VARARGS
},
{
"log_archive"
,
(
PyCFunction
)
DBEnv_log_archive
,
METH_VARARGS
},
...
...
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