Skip to content

Commit 52b434d

Browse files
committed
remove import for isnewbytes
1 parent 7efd55d commit 52b434d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/future/utils/__init__.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -577,15 +577,13 @@ def isbytes(obj):
577577

578578
def isnewbytes(obj):
579579
"""
580-
Equivalent to the result of ``isinstance(obj, newbytes)`` were
581-
``__instancecheck__`` not overridden on the newbytes subclass. In
582-
other words, it is REALLY a newbytes instance, not a Py2 native str
580+
Equivalent to the result of ``type(obj) == type(newbytes)``
581+
in other words, it is REALLY a newbytes instance, not a Py2 native str
583582
object?
583+
Note that this does not cover subclasses of newbytes, and it is not
584+
equivalent to ininstance(obj, newbytes)
584585
"""
585-
# TODO: generalize this so that it works with subclasses of newbytes
586-
# Import is here to avoid circular imports:
587-
from future.types.newbytes import newbytes
588-
return type(obj) == newbytes
586+
return type(obj).__name__ == 'newbytes'
589587

590588

591589
def isint(obj):

0 commit comments

Comments
 (0)