New submission from Serhiy Storchaka:

In most cases when str object required, unicode object is allowed too. "s" and 
"z" codes (with modifiers) in PyArg_Parse*() accept both str and unicode 
instances. But "c" code accepts only 1-character str, not unicode. This makes 
harder writing version-agnostic code with imported unicode_literals (2.7 
functions require bytes literals, 3.x functions require unicode literals) and 
breaks pickle compatibility (see issue13566).

This change will affect:

* str.ljust(), str.rjust() and str.center();
* '%c' % char;
* mmap.write_byte();
* array constructor and item setter for 'c' type;
* datetime.isoformat();
* bsddb.set_re_delim() and bsddb.set_re_pad();
* msvcrt.putch() and msvcrt.ungetch();
* swi.block.padstring().

----------
components: Interpreter Core
files: getargs_c_unicode.patch
keywords: patch
messages: 206529
nosy: alexandre.vassalotti, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Allow 1-character ASCII unicode where 1-character str is required
versions: Python 2.7
Added file: http://bugs.python.org/file33193/getargs_c_unicode.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20015>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to