19
19
#include "python-tg.h"
20
20
21
21
extern struct tgl_state * TLS ;
22
-
23
22
// TGL Python Exceptions
24
23
extern PyObject * TglError ;
25
24
extern PyObject * PeerError ;
@@ -944,14 +943,18 @@ tgl_Peer_repr(tgl_Peer *self)
944
943
945
944
switch (self -> peer -> id .type ) {
946
945
case TGL_PEER_USER :
947
- ret = PyUnicode_FromFormat ("<tgl.Peer: type=user, id=%ld, username=%R, name=%R, first_name=%R, last_name=%R, phone=%R>" ,
946
+ #if PY_VERSION_HEX < 0x02070900
947
+ ret = PyUnicode_FromFormat ("<tgl.Peer: id=%ld>" , self -> peer -> id .id );
948
+ #else
949
+ ret = PyUnicode_FromFormat ("<tgl.Peer: type=user, id=%ld, username=%R, name=%R, first_name=%R, last_name=%R, phone=%R>" ,
948
950
self -> peer -> id .id ,
949
951
PyObject_GetAttrString ((PyObject * )self , "username" ),
950
952
PyObject_GetAttrString ((PyObject * )self , "name" ),
951
953
PyObject_GetAttrString ((PyObject * )self , "first_name" ),
952
954
PyObject_GetAttrString ((PyObject * )self , "last_name" ),
953
955
PyObject_GetAttrString ((PyObject * )self , "phone" )
954
956
);
957
+ #endif
955
958
break ;
956
959
case TGL_PEER_CHAT :
957
960
ret = PyUnicode_FromFormat ("<tgl.Peer: type=chat, id=%ld, name=%s>" ,
@@ -1423,7 +1426,9 @@ static PyObject *
1423
1426
tgl_Msg_repr (tgl_Msg * self )
1424
1427
{
1425
1428
PyObject * ret ;
1426
-
1429
+ #if PY_VERSION_HEX < 0x02070900
1430
+ ret = PyUnicode_FromFormat ("<tgl.Msg id=%ld>" , self -> msg -> id );
1431
+ #else
1427
1432
ret = PyUnicode_FromFormat ("<tgl.Msg id=%ld, flags=%d, mention=%R, out=%R, unread=%R, service=%R, src=%R, "
1428
1433
"dest=%R, text=%R, media=%R, date=%R, fwd_src=%R, fwd_date=%R, reply_id=%R, reply=%R>" ,
1429
1434
self -> msg -> id , self -> msg -> flags ,
@@ -1441,7 +1446,7 @@ tgl_Msg_repr(tgl_Msg *self)
1441
1446
PyObject_GetAttrString ((PyObject * )self , "reply_id" ),
1442
1447
PyObject_GetAttrString ((PyObject * )self , "reply" )
1443
1448
);
1444
-
1449
+ #endif
1445
1450
return ret ;
1446
1451
}
1447
1452
0 commit comments