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
e7901c5e
Kaydet (Commit)
e7901c5e
authored
Mar 01, 2010
tarafından
Florent Xicluna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#7808: Fix reference leaks in _bsddb and related tests.
üst
fe6f07c0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
4 deletions
+20
-4
test_compare.py
Lib/bsddb/test/test_compare.py
+1
-0
test_replication.py
Lib/bsddb/test/test_replication.py
+12
-0
NEWS
Misc/NEWS
+3
-1
_bsddb.c
Modules/_bsddb.c
+4
-3
No files found.
Lib/bsddb/test/test_compare.py
Dosyayı görüntüle @
e7901c5e
...
...
@@ -193,6 +193,7 @@ class BtreeExceptionsTestCase (AbstractBtreeKeyCompareTestCase):
errorOut
=
temp
.
getvalue
()
if
not
successRe
.
search
(
errorOut
):
self
.
fail
(
"unexpected stderr output:
\n
"
+
errorOut
)
sys
.
exc_traceback
=
sys
.
last_traceback
=
None
def
_test_compare_function_exception
(
self
):
self
.
startTest
()
...
...
Lib/bsddb/test/test_replication.py
Dosyayı görüntüle @
e7901c5e
...
...
@@ -4,6 +4,7 @@
import
os
import
time
import
unittest
import
weakref
from
test_all
import
db
,
test_support
,
have_threads
,
verbose
,
\
get_new_environment_path
,
get_new_database_path
...
...
@@ -34,13 +35,16 @@ class DBReplicationManager(unittest.TestCase):
|
db
.
DB_INIT_LOG
|
db
.
DB_INIT_MPOOL
|
db
.
DB_INIT_LOCK
|
db
.
DB_INIT_REP
|
db
.
DB_RECOVER
|
db
.
DB_THREAD
,
0666
)
wr
=
weakref
.
ref
(
self
)
self
.
confirmed_master
=
self
.
client_startupdone
=
False
def
confirmed_master
(
a
,
b
,
c
)
:
if
b
==
db
.
DB_EVENT_REP_MASTER
:
self
=
wr
()
self
.
confirmed_master
=
True
def
client_startupdone
(
a
,
b
,
c
)
:
if
b
==
db
.
DB_EVENT_REP_STARTUPDONE
:
self
=
wr
()
self
.
client_startupdone
=
True
self
.
dbenvMaster
.
set_event_notify
(
confirmed_master
)
...
...
@@ -215,12 +219,15 @@ class DBReplicationManager(unittest.TestCase):
class
DBBaseReplication
(
DBReplicationManager
):
def
setUp
(
self
)
:
DBReplicationManager
.
setUp
(
self
)
wr
=
weakref
.
ref
(
self
)
def
confirmed_master
(
a
,
b
,
c
)
:
if
(
b
==
db
.
DB_EVENT_REP_MASTER
)
or
(
b
==
db
.
DB_EVENT_REP_ELECTED
)
:
self
=
wr
()
self
.
confirmed_master
=
True
def
client_startupdone
(
a
,
b
,
c
)
:
if
b
==
db
.
DB_EVENT_REP_STARTUPDONE
:
self
=
wr
()
self
.
client_startupdone
=
True
self
.
dbenvMaster
.
set_event_notify
(
confirmed_master
)
...
...
@@ -233,9 +240,11 @@ class DBBaseReplication(DBReplicationManager):
# There are only two nodes, so we don't need to
# do any routing decision
def
m2c
(
dbenv
,
control
,
rec
,
lsnp
,
envid
,
flags
)
:
self
=
wr
()
self
.
m2c
.
put
((
control
,
rec
))
def
c2m
(
dbenv
,
control
,
rec
,
lsnp
,
envid
,
flags
)
:
self
=
wr
()
self
.
c2m
.
put
((
control
,
rec
))
self
.
dbenvMaster
.
rep_set_transport
(
13
,
m2c
)
...
...
@@ -252,10 +261,12 @@ class DBBaseReplication(DBReplicationManager):
#self.dbenvClient.set_verbose(db.DB_VERB_FILEOPS_ALL, True)
def
thread_master
()
:
self
=
wr
()
return
self
.
thread_do
(
self
.
dbenvMaster
,
self
.
c2m
,
3
,
self
.
master_doing_election
,
True
)
def
thread_client
()
:
self
=
wr
()
return
self
.
thread_do
(
self
.
dbenvClient
,
self
.
m2c
,
13
,
self
.
client_doing_election
,
False
)
...
...
@@ -408,6 +419,7 @@ class DBBaseReplication(DBReplicationManager):
break
except
db
.
DBRepUnavailError
:
pass
if
not
election_status
[
0
]
and
not
self
.
confirmed_master
:
from
threading
import
Thread
election_status
[
0
]
=
True
...
...
Misc/NEWS
Dosyayı görüntüle @
e7901c5e
...
...
@@ -35,7 +35,7 @@ Core and Builtins
Library
-------
- Issue #1729305: Fix doctest to handle encode error with "backs
p
lashreplace".
- Issue #1729305: Fix doctest to handle encode error with "backslashreplace".
- Issue #691291: codecs.open() should not convert end of lines on reading and
writing.
...
...
@@ -83,6 +83,8 @@ Library
Extension Modules
-----------------
- Issue #7808: Fix reference leaks in _bsddb and related tests.
- Issue #6544: fix a reference leak in the kqueue implementation's error
handling.
...
...
Modules/_bsddb.c
Dosyayı görüntüle @
e7901c5e
...
...
@@ -2382,8 +2382,6 @@ _db_compareCallback(DB* db,
args
=
BuildValue_SS
(
leftKey
->
data
,
leftKey
->
size
,
rightKey
->
data
,
rightKey
->
size
);
if
(
args
!=
NULL
)
{
/* XXX(twouters) I highly doubt this INCREF is correct */
Py_INCREF
(
self
);
result
=
PyEval_CallObject
(
self
->
btCompareCallback
,
args
);
}
if
(
args
==
NULL
||
result
==
NULL
)
{
...
...
@@ -2432,10 +2430,12 @@ DB_set_bt_compare(DBObject* self, PyObject* comparator)
if
(
result
==
NULL
)
return
NULL
;
if
(
!
NUMBER_Check
(
result
))
{
Py_DECREF
(
result
);
PyErr_SetString
(
PyExc_TypeError
,
"callback MUST return an int"
);
return
NULL
;
}
else
if
(
NUMBER_AsLong
(
result
)
!=
0
)
{
Py_DECREF
(
result
);
PyErr_SetString
(
PyExc_TypeError
,
"callback failed to return 0 on two empty strings"
);
return
NULL
;
...
...
@@ -5776,6 +5776,8 @@ DBEnv_repmgr_site_list(DBEnvObject* self)
free
(
listp
);
return
NULL
;
}
Py_DECREF
(
key
);
Py_DECREF
(
tuple
);
}
free
(
listp
);
return
stats
;
...
...
@@ -7578,4 +7580,3 @@ PyMODINIT_FUNC PyInit__pybsddb(void) /* Note the two underscores */
return
PyInit__bsddb
();
/* Note the two underscores */
#endif
}
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