Commit 35ab9f3774e12f821cde37f5316b0f1c038516bb

Authored by Perry Werneck
1 parent 76b9754f
Exists in master

Fixing session subclassing flag.

Showing 2 changed files with 28 additions and 9 deletions   Show diff stats
src/session/type.c
... ... @@ -143,7 +143,7 @@ PyTypeObject py3270_session_type = {
143 143 .tp_doc = "TN3270 Session Object",
144 144 .tp_basicsize = sizeof(pySession),
145 145 .tp_itemsize = 0,
146   - .tp_flags = Py_TPFLAGS_HAVE_FINALIZE|Py_TPFLAGS_DEFAULT,
  146 + .tp_flags = Py_TPFLAGS_HAVE_FINALIZE|Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
147 147  
148 148 .tp_new = py3270_session_alloc,
149 149 .tp_dealloc = py3270_session_dealloc,
... ...
testprograms/sample.py
... ... @@ -4,13 +4,32 @@
4 4 #import inspect
5 5 import tn3270
6 6  
7   -print("Using TN3270 Version " + tn3270.version())
8   -print(tn3270.revision())
  7 +class Host(tn3270.Session):
9 8  
10   -session = tn3270.Session("")
11   -session.timeout = 10
  9 + def __init__(self):
12 10  
13   -print("Using tn3270 version " + session.version + " revision " + session.revision)
  11 + super().__init__(":a")
  12 + print("Using tn3270 version " + self.version + " revision " + self.revision)
  13 +
  14 + def reconnect(self):
  15 + if super().reconnect.activatable:
  16 + print("Reconnecting...")
  17 + super().reconnect().wait(10)
  18 +
  19 +
  20 +host = Host()
  21 +
  22 +host.reconnect()
  23 +
  24 +
  25 +
  26 +#print("Using TN3270 Version " + tn3270.version())
  27 +#print(tn3270.revision())
  28 +
  29 +#session = tn3270.Session("")
  30 +#session.timeout = 10
  31 +
  32 +#print("Using tn3270 version " + session.version + " revision " + session.revision)
14 33  
15 34 #print(session.cstate)
16 35 #print(session.width)
... ... @@ -21,9 +40,9 @@ print("Using tn3270 version " + session.version + " revision " + session.revisio
21 40 #
22 41 # Can reconnect? If yes do it!
23 42 #
24   -if session.reconnect.activatable:
25   - print("Reconnecting...")
26   - session.reconnect().wait(10)
  43 +#if session.reconnect.activatable:
  44 +# print("Reconnecting...")
  45 +# session.reconnect().wait(10)
27 46  
28 47 #print(session.connected)
29 48 #print(session.find('sisbb'))
... ...