New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using pickled/unpickled sqlite3.Row results in segfault rather than exception #66174
Comments
Pickling, unpickling, then using an sqlite3.Row object results in a segfault on at least Python 3.3.5, 3.4.0, and 3.4.1. I have attached a test case and a backtrace below. I know you're not supposed to pickle sqlite3.Row objects, as the given test case below results in an exception to the effect that sqlite3.Row objects cannot be pickled in Python 2.7. I don't think a segfault is the desired behaviour, however... |
The backtrace of the crash, if it helps |
Hi, thanks for the report. Here's a patch which implements __setstate__ and __getstate__ for Row objects. |
The issue is not in pickling/unpickling, but in sqlite3.Row.__new__ which creates object in invalid state. Simple example: >>> import sqlite3
>>> r = sqlite3.Row.__new__(sqlite3.Row)
>>> len(r)
Segmentation fault (core dumped) |
Using your example, I can't make it to crash using the tip, nor with Python 3.4. |
Nevermind, I didn't see the len call. |
Here is a patch which fixes crash. |
It doesn't crash anymore with your patch, but the pickle.load fails: Traceback (most recent call last):
File "a.py", line 19, in <module>
load = pickle.loads(dump)
TypeError: function takes exactly 2 arguments (0 given) |
For pickling open other issue. |
Ups, I accidentally removed the patch review stage, sorry for that. |
New changeset c46ad743bcb4 by Serhiy Storchaka in branch '2.7': New changeset c1ca1c4c131b by Serhiy Storchaka in branch '3.4': New changeset 9244ed41057a by Serhiy Storchaka in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: