From 4f73e4fe3147e320412e7e794ceb63c1a6f26a46 Mon Sep 17 00:00:00 2001
From: Todd Chapman <chakatodd@users.noreply.github.com>
Date: Thu, 27 Aug 2015 11:26:43 -0400
Subject: [PATCH] Fixed AttributeError when calling get_app_data()

---
 src/OpenSSL/SSL.py | 1 +
 tests/test_ssl.py  | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/OpenSSL/SSL.py b/src/OpenSSL/SSL.py
index 190e4ac64..0dbabc1a7 100644
--- a/src/OpenSSL/SSL.py
+++ b/src/OpenSSL/SSL.py
@@ -1083,6 +1083,7 @@ def __init__(self, context, socket=None):
         ssl = _lib.SSL_new(context._context)
         self._ssl = _ffi.gc(ssl, _lib.SSL_free)
         self._context = context
+        self._app_data = None
 
         # References to strings used for Next Protocol Negotiation. OpenSSL's
         # header files suggest that these might get copied at some point, but
diff --git a/tests/test_ssl.py b/tests/test_ssl.py
index 92dff5faf..de144ce5c 100644
--- a/tests/test_ssl.py
+++ b/tests/test_ssl.py
@@ -2401,9 +2401,10 @@ def test_app_data(self):
         :py:obj:`Connection.get_app_data`.
         """
         conn = Connection(Context(TLSv1_METHOD), None)
+        assert None is conn.get_app_data()
         app_data = object()
         conn.set_app_data(app_data)
-        self.assertIdentical(conn.get_app_data(), app_data)
+        assert conn.get_app_data() is app_data
 
     def test_makefile(self):
         """