#27 Using type() comparison instead of isinstance() and rpyc

v1.0 (example)
closed-fixed
nobody
None
5
2014-06-03
2009-05-06
Brendon Costa
No

I would like to use pexpect with rpyc (http://rpyc.wikidot.com/). The issue is the type checking done in pexpect compares for exact types not instances of a particular type. For example in compile_pattern_list() there is some code like:

if type(patterns) is not types.ListType:
...

Rather than checking for an exact type types.ListType, it could check for an instance of types.ListType and be a little more flexible:
if not isinstance(patterns, types.ListType):
...

If the above is applied to a number of places in pexpect, then it seems to work fine with pyrc. I have made some patches for this that I am using, it seems to work fine for me. I will use them for a bit longer in testing. Should i submit these patche? Will they be accepted?

Thanks,
Brendon.

Discussion

  • Brendon Costa
    Brendon Costa
    2009-05-06

    • summary: Using type() comparison instead of isinstance and rpyc --> Using type() comparison instead of isinstance() and rpyc
     
  • shaybery
    shaybery
    2012-08-22

    Hello

    I am just using pexpect(2.3) with RPyC, and i got the same problem.
    Did any one fix it already?? (type to isinstace)

     
  • Thomas Kluyver
    Thomas Kluyver
    2014-06-03

    I believe this is fixed since Pexpect moved to Github. If you can still find issues, please report them on the GH issue tracker.

     
  • Thomas Kluyver
    Thomas Kluyver
    2014-06-03

    • status: open --> closed-fixed
    • Group: --> v1.0 (example)