XZise added a comment.

The mentioned django bug report does not mention 
https://www.python.org/dev/peps/pep-3138/#motivation:

> - Convert other non-printable characters(0x00-0x1f, 0x7f) and non-ASCII 
> characters (>= 0x80) to '\xXX'.

> 

>   […]

> 

>   For Unicode strings, the following additional conversions are done.

> - Convert leading surrogate pair characters without trailing character 
> (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\uXXXX'.

> - Convert 16-bit characters (>= 0x100) to '\uXXXX'.

> - Convert 21-bit characters (>= 0x10000) and surrogate pair characters to 
> '\U00xxxxxx'.

> 

>   […]

> 

>   This algorithm converts any string to printable ASCII, and repr() is used 
> as a handy and safe way to print strings for debugging or for logging.


So at least when Python 3 was implemented the `repr()` function defined as as 
returning ASCII. But who knows if they meant `bytes` or `ASCII compatible str`. 
So in the end it might be legitimate to return unicode but then only containing 
ASCII characters (and then Python would automatically convert one into the 
other without a problem).


TASK DETAIL
  https://phabricator.wikimedia.org/T66958

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: XZise
Cc: XZise, Aklapper, valhallasw, gerritbot, Dalba, Xqt, jayvdb, 
pywikibot-bugs-list, Ladsgroup



_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to