Skip to content

Commit 6299a10

Browse files
committed
-
1 parent e9355bd commit 6299a10

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

python_toolbox/third_party/abcs_collection.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Ram's note: This is cut out of Python 2.7's `_abcoll` module.
1+
# Ram's note: This is cut out of Python 2.7's `_abcoll` module, and hacked a
2+
# bit.
23

34
# Copyright 2007 Google, Inc. All Rights Reserved.
45
# Licensed to PSF under a Contributor Agreement.
@@ -555,6 +556,17 @@ def index(self, value):
555556

556557
def count(self, value):
557558
return sum(1 for v in self if v == value)
559+
560+
@classmethod
561+
def __subclasshook__(cls, subclass_candidate):
562+
# Hacking around a Pypy bug:
563+
if cls is Sequence and \
564+
issubclass(subclass_candidate, (tuple, basestring, buffer, xrange)):
565+
print('Got true!')
566+
return True
567+
else:
568+
return NotImplemented
569+
558570

559571
Sequence.register(tuple)
560572
Sequence.register(basestring)

0 commit comments

Comments
 (0)