[pypy-issue] [issue1325] pypy + sqlite3 problem on Mac OSX

Alex tracker at bugs.pypy.org
Wed Nov 14 16:43:08 CET 2012


New submission from Alex <antoniadis.alexandros.87 at gmail.com>:

Greetings,

I recently faced a pretty weird problem when I tried to run a trivial python script that opened 
nested connection to a sqlite database.
The script is the following:

---
import sqlite3

DATABASE_LOCATION = './dummy.db'

def another_sql_connection():
    with sqlite3.connect(DATABASE_LOCATION) as con:
        pass

def an_sql_connection():
    with sqlite3.connect(DATABASE_LOCATION) as con:
        cur = con.cursor()
        sql_match_query = "select * from dummy_table;"

        cur.execute(sql_match_query);
        for row in cur.fetchall():
            another_sql_connection()
            print row

an_sql_connection()

---

Assuming that there is a database (sqlite) named dummy.db at the same directory with the python 
script I run which contains a table called dummy_table with 500 rows. In my example the table 
has only one field called id which is an integer.

The error I get is the following:
...
(250,)
(251,)
(252,)
Traceback (most recent call last):
  File "app_main.py", line 51, in run_toplevel
  File "example.py", line 19, in <module>
  File "example.py", line 16, in an_sql_connection
  File "example.py", line 6, in another_sql_connection
  File "/Users/alex/Desktop/pypy-1.9/lib_pypy/_sqlite3.py", line 279, in connect
  File "/Users/alex/Desktop/pypy-1.9/lib_pypy/_sqlite3.py", line 311, in __init_


So after 252 successful connections this strange error occurred.
Note that this error happens only on Mac OSX, I've tested it on Linux and it works as expected 
and that when I run the script with python on Mac OSX it also works fine.

So, I think that something strange happens on the pypy version (1.9) for Mac OSX (at least for 
the sqlite module).

If you want me to provide you some more details about the systems I've tested the code let me 
know.

Regards,
Alex

----------
messages: 4996
nosy: alex.a, pypy-issue
priority: bug
status: unread
title: pypy + sqlite3 problem on Mac OSX

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1325>
________________________________________


More information about the pypy-issue mailing list