This project is archived and is in readonly mode.
sefault on mogrify with a Decimal
Submitted by: Nate C
after this ...
from decimal import Decimal
conn = psycopg2.connect('dbname=test')
cursor = conn.cursor()
cursor.mogrify('select %s', (Decimal('3.27'),))
.. python crashes
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
2.2.2 (dt dec ext pq3)
Comments and changes to this ticket
- State changed from new to resolved
- Milestone set to release-2.3.0
- Milestone order changed from 4 to 0
Thank you for the report. I had already refactored mogrify to use more code in common with execute (mostly to support unicode queries) and as a result this bug was fixed. I will add a regression test though.
In : cursor.mogrify('select %s', (Decimal('3.27'),))
Out: 'select 3.27'
Code available in the python2 branch of my git repository http://tinyurl.com/piro-psycopg2 <git://src.develer.com/users/piro/psycopg2.git>, soon to be released.
I've found the cause of the crash: the Decimal adapter incorrectly assumed the existence of the
is_finite()method: it was actually introduced somewhere after 2.5.1 and is available e.g. in 2.5.4.
I've fixed the issue in my repos, but the bug is still present in the 2.3.0-beta1. Jason is preparing a Window package.
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.