carpedm20 / carpedm20/LINE

Bug in _findContactByUserid

Open
#80 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
827
Forks
189
PR merge metrics
No merged PRs in 30d

Description

There is recursion bug in function _findContactByUserid, as shown:

```
Python 2.7.10 (default, Jan 10 2016, 14:48:07)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
__> from line import LineClient
__> client = LineClient(authToken="xxxxxx")
__> client.findContactByUserid("yyyyy")
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'LineClient' object has no attribute 'findContactByUserid'
__> client._findContactByUserid("yyyyy")
Traceback (most recent call last):
File "", line 1, in
File "line/client.py", line 27, in wrapper_check_auth
return func(*args, **kwargs)
File "line/client.py", line 253, in _findContactByUserid
contact = self._findContactByUserid(userid)
File "line/client.py", line 27, in wrapper_check_auth
return func(*args, **kwargs)
File "line/client.py", line 253, in _findContactByUserid
contact = self._findContactByUserid(userid)
-=REPEATS=-
RuntimeError: maximum recursion depth exceeded
__>
```

The fix seems to be

```
$ diff -Naur line2/client.py line/client.py
--- line2/client.py 2016-09-07 11:47:38.729857006 +0800
+++ line/client.py 2016-09-04 21:52:29.243941119 +0800
@@ -244,7 +244,7 @@
return c

@check_auth
- def _findContactByUserid(self, userid):
+ def findContactByUserid(self, userid):
"""Find a `contact` by userid

:param userid: user id
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.