summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-07-01 02:09:56 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-07-01 02:11:21 +0100
commit7aedc61d410a551f74cf9b721b794c1540377887 (patch)
tree93ef6448f853ae777bc6bb529db75910ca8ddfff
parentb7330283bc13ee6b2072f333acbf1b84aff0206a (diff)
downloadpsycopg2-7aedc61d410a551f74cf9b721b794c1540377887.tar.gz
Fixed segfault on repr() for uninitialized connections
Close #361.
-rw-r--r--NEWS5
-rw-r--r--psycopg/connection_type.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 52307ed..9056b0f 100644
--- a/NEWS
+++ b/NEWS
@@ -24,12 +24,13 @@ What's new in psycopg 2.6.2
^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 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
long-running query in an interactive shell using :kbd:`Ctrl-C`
(:ticket:`#333`).
-- Raise `!NotSupportedError` on unhandled server response status
- (:ticket:`#352`).
- Fixed `!PersistentConnectionPool` on Python 3 (:ticket:`#348`).
+- Fixed segfault on `repr()` of an unitialized connection (:ticket:`#361`).
- Added support for setuptools/wheel (:ticket:`#370`).
- Fix build on Windows with Python 3.5, VS 2015 (:ticket:`#380`).
- Fixed `!errorcodes.lookup` initialization thread-safety (:ticket:`#382`).
diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c
index 2c1dddf..e1966b3 100644
--- a/psycopg/connection_type.c
+++ b/psycopg/connection_type.c
@@ -1171,7 +1171,7 @@ connection_repr(connectionObject *self)
{
return PyString_FromFormat(
"<connection object at %p; dsn: '%s', closed: %ld>",
- self, self->dsn, self->closed);
+ self, (self->dsn ? self->dsn : "<unintialized>"), self->closed);
}
static int