classification
Title: Memory leak in comparison of sqlite.Row objects
Type: resource usage Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8, Python 3.7, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, ghaering, miss-islington, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2019-09-15 07:29 by serhiy.storchaka, last changed 2019-09-17 06:56 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16155 merged serhiy.storchaka, 2019-09-15 07:31
PR 16193 merged miss-islington, 2019-09-16 17:15
PR 16194 merged miss-islington, 2019-09-16 17:15
PR 16215 merged serhiy.storchaka, 2019-09-17 06:13
Messages (5)
msg352465 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-09-15 07:29
There is a memory leak in comparison of sqlite.Row objects when row descriptors are different. There were not tests for this case.

Also, the code compares the result of PyObject_RichCompare() with Py_True and Py_False. It is better to avoid such code, because technically PyObject_RichCompare() can return an arbitrary value, although in this particular case description can only be tuple or None (or NULL, but this is other issue).

Also, there is a test for inequality of hash codes. Since hashes depend on hashes of strings, they value is random, and there is a small chance of failure. Hashes should not be tested for inequality.
msg352558 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-09-16 17:15
New changeset 8debfa50407107ff2329d01081cdc12d359f1d12 by Serhiy Storchaka in branch 'master':
bpo-38175: Fix a memory leak in comparison of sqlite3.Row objects. (GH-16155)
https://github.com/python/cpython/commit/8debfa50407107ff2329d01081cdc12d359f1d12
msg352601 - (view) Author: miss-islington (miss-islington) Date: 2019-09-17 06:14
New changeset f04299d978793be33828dc4d5f46e9b54c81a0a2 by Miss Islington (bot) in branch '3.8':
bpo-38175: Fix a memory leak in comparison of sqlite3.Row objects. (GH-16155)
https://github.com/python/cpython/commit/f04299d978793be33828dc4d5f46e9b54c81a0a2
msg352602 - (view) Author: miss-islington (miss-islington) Date: 2019-09-17 06:14
New changeset 4ac1be28281d8961e71b13623c3671245c125760 by Miss Islington (bot) in branch '3.7':
bpo-38175: Fix a memory leak in comparison of sqlite3.Row objects. (GH-16155)
https://github.com/python/cpython/commit/4ac1be28281d8961e71b13623c3671245c125760
msg352614 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-09-17 06:56
New changeset be257bcad12b1d72a2c2a8199d2291ae22bccf78 by Serhiy Storchaka in branch '2.7':
[2.7] bpo-38175: Fix a memory leak in comparison of sqlite3.Row objects. (GH-16155). (GH-16215)
https://github.com/python/cpython/commit/be257bcad12b1d72a2c2a8199d2291ae22bccf78
History
Date User Action Args
2019-09-17 06:56:48serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-09-17 06:56:30serhiy.storchakasetmessages: + msg352614
2019-09-17 06:14:32miss-islingtonsetmessages: + msg352602
2019-09-17 06:14:23miss-islingtonsetnosy: + miss-islington
messages: + msg352601
2019-09-17 06:13:45serhiy.storchakasetpull_requests: + pull_request15816
2019-09-16 17:15:37miss-islingtonsetpull_requests: + pull_request15800
2019-09-16 17:15:30miss-islingtonsetpull_requests: + pull_request15799
2019-09-16 17:15:22serhiy.storchakasetmessages: + msg352558
2019-09-15 07:31:34serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request15765
2019-09-15 07:29:07serhiy.storchakacreate