[issue38003] Incorrect "fixing" of isinstance tests for basestring

2019-09-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: basestring in Python 2 means "thing that is logically text", because in Python 2, str can mean *either* logical text *or* binary data, and unicode is always logical text. str and unicode can kinda sorta interoperate on Python 2, so it can make sense to test

[issue38003] Incorrect "fixing" of isinstance tests for basestring

2019-09-06 Thread Bob Kline
Bob Kline added the comment: > Unless you have a specific proposal, ... I _do_ have a specific proposal: replace `basestring` with `(str, bytes)`, which preserves the behavior of the original code. So, if isinstance(value, basestring) becomes if isinstance(value, (str, bytes))

[issue38003] Incorrect "fixing" of isinstance tests for basestring

2019-09-06 Thread Terry J. Reedy
Terry J. Reedy added the comment: Bob, this issue tracker is for managing patches to the cpython repository. not for 'help me understand' requests, The latter belong on, for instance, python-list. Unless you have a specific proposal, other than leaving 'basestring' alone(1), that we

[issue38003] Incorrect "fixing" of isinstance tests for basestring

2019-09-01 Thread Bob Kline
Bob Kline added the comment: > Use str instead. Sure. I understand the advantages of the new approach to strings. Which, by the way, weren't available when this project began. I don't disagree with anything you say in the context of writing new code. I was, however, surprised and dismayed

[issue38003] Incorrect "fixing" of isinstance tests for basestring

2019-09-01 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: https://docs.python.org/3.0/whatsnew/3.0.html > The builtin basestring abstract type was removed. Use str instead. The str > and bytes types don’t have functionality enough in common to warrant a shared > base class. The 2to3 tool (see below)

[issue38003] Incorrect "fixing" of isinstance tests for basestring

2019-09-01 Thread Bob Kline
New submission from Bob Kline : We are attempting to convert a large Python 2 code base. Following the guidance of the official documentation (https://docs.python.org/2/library/functions.html#basestring) we created tests in many, many places that look like this: if isinstance(value,