This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tokeefe
Recipients tokeefe
Date 2013-08-19.15:33:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1376926405.17.0.0447575429203.issue18782@psf.upfronthosting.co.za>
In-reply-to
Content
If you run this code, you will get a segfault. If you a) remove the row factory from the following code or b) use the standard library map() instead of multiprocessing.Pool.map, then the code does not crash.

#!/usr/bin/env python

import sqlite3
import multiprocessing as mp

def main():
    ## --- create a database
    conn = sqlite3.connect(':memory:')
    conn.row_factory = sqlite3.Row
    c = conn.cursor()

    ## --- create example table similar to python docs
    c.execute('''CREATE TABLE stocks (date text, trans text, symbol text, qty real, price real)''')
    c.execute("INSERT INTO stocks VALUES ('2006-01-05','BUY','GOOG',100,869.29)")
    c.execute("INSERT INTO stocks VALUES ('1992-01-06','SELL','AAPL',20,512.99)")
    c.execute("SELECT * FROM stocks")

    ## --- map fun over cursor iterable (fun does nothing)
    pool = mp.Pool(processes=mp.cpu_count())
    features = pool.map(fun, c)

def fun(row):
    return row

if __name__ == "__main__":
    main()
History
Date User Action Args
2013-08-19 15:33:25tokeefesetrecipients: + tokeefe
2013-08-19 15:33:25tokeefesetmessageid: <1376926405.17.0.0447575429203.issue18782@psf.upfronthosting.co.za>
2013-08-19 15:33:25tokeefelinkissue18782 messages
2013-08-19 15:33:24tokeefecreate