Fixed segfault on repr() for uninitialized connections

Close #361.
This commit is contained in:
Daniele Varrazzo 2016-07-01 02:09:56 +01:00
parent 05f23df238
commit 8dff6a38c7
2 changed files with 4 additions and 3 deletions

5
NEWS
View File

@ -5,12 +5,13 @@ What's new in psycopg 2.6.2
^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Report the server response status on errors (such as :ticket:`#281`). - Report the server response status on errors (such as :ticket:`#281`).
- Raise `!NotSupportedError` on unhandled server response status
(:ticket:`#352`).
- The `~psycopg2.extras.wait_select` callback allows interrupting a - The `~psycopg2.extras.wait_select` callback allows interrupting a
long-running query in an interactive shell using :kbd:`Ctrl-C` long-running query in an interactive shell using :kbd:`Ctrl-C`
(:ticket:`#333`). (:ticket:`#333`).
- Raise `!NotSupportedError` on unhandled server response status
(:ticket:`#352`).
- Fixed `!PersistentConnectionPool` on Python 3 (:ticket:`#348`). - Fixed `!PersistentConnectionPool` on Python 3 (:ticket:`#348`).
- Fixed segfault on `repr()` of an unitialized connection (:ticket:`#361`).
- Added support for setuptools/wheel (:ticket:`#370`). - Added support for setuptools/wheel (:ticket:`#370`).
- Fix build on Windows with Python 3.5, VS 2015 (:ticket:`#380`). - Fix build on Windows with Python 3.5, VS 2015 (:ticket:`#380`).
- Fixed `!errorcodes.lookup` initialization thread-safety (:ticket:`#382`). - Fixed `!errorcodes.lookup` initialization thread-safety (:ticket:`#382`).

View File

@ -1172,7 +1172,7 @@ connection_repr(connectionObject *self)
{ {
return PyString_FromFormat( return PyString_FromFormat(
"<connection object at %p; dsn: '%s', closed: %ld>", "<connection object at %p; dsn: '%s', closed: %ld>",
self, self->dsn, self->closed); self, (self->dsn ? self->dsn : "<unintialized>"), self->closed);
} }
static int static int