This project is archived and is in readonly mode.

#102 ✓ resolved
Psycopg website

cursor is not compatible with the with statement

Reported by Psycopg website | February 22nd, 2012 @ 07:07 PM | in 2.5 (closed)

Submitted by: Valentin Lorentz

Hi,

The following line: (Python 2.7)

with connection.cursor() as cur:

raises this:

AttributeError: __exit__

Regards,
Valentin Lorentz

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo February 22nd, 2012 @ 10:33 PM

    Nobody has ever said it was.

  • Daniele Varrazzo

    Daniele Varrazzo February 22nd, 2012 @ 11:06 PM

    • State changed from “new” to “hold”

    Ticket put on hold: I don't want to add with support until the DB-SIG decides what should be its semantic. I'm not so worried about the cursor: more about the connection as there could be several ways to exit it. Notice though that cursors (the regular ones, not named ones) don't really hold any resource except the memory they have allocated, so using them into a with context doesn't really protect anything.

  • Daniele Varrazzo

    Daniele Varrazzo December 3rd, 2012 @ 12:32 AM

    • State changed from “hold” to “open”
    • Milestone set to 2.5
    • Milestone order changed from “90” to “0”

    To be implemented as specified by the new DB-API extension

  • Daniele Varrazzo

    Daniele Varrazzo December 4th, 2012 @ 12:40 AM

    • State changed from “open” to “resolved”

    implemented in devel, to be released in 2.5

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

WARNING: the informations in this tracker are archived. Please submit new tickets or comments to the new tracker.


Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

Pages