Revision eb69908b5cfdf568e01356f96d01cd146979cfe7 authored by Paul Ganssle on 22 October 2018, 16:32:52 UTC, committed by Miss Islington (bot) on 22 October 2018, 19:37:55 UTC
* Use _PyUnicode_Copy in sanitize_isoformat_str

* Use repr in fromisoformat error message

This reverses commit 67b74a98b2 per Serhiy Storchaka's suggestion:

     I suggested to use %R in the error message because including the raw
     string can be confusing in the case of empty string, or string
     containing trailing whitespaces, invisible or unprintable characters.

We agree that it is better to change both the C and pure Python versions
to use repr.

* Retain non-sanitized dtstr for error printing

This does not create an extra string, it just holds on to a reference to
the original input string for purposes of creating the error message.

* PEP 7 fixes to from_isoformat

* Separate handling of Unicode and other errors

In the initial implementation, errors other than encoding errors would
both raise an error indicating an invalid format, which would not be
true for errors like MemoryError.

* Drop needs_decref from _sanitize_isoformat_str

Instead _sanitize_isoformat_str returns a new reference, even to the
original string.
(cherry picked from commit 3df85404d4bf420db3362eeae1345f2cad948a71)

Co-authored-by: Paul Ganssle <pganssle@users.noreply.github.com>
1 parent 7f34d55
History
File Mode Size
.azure-pipelines
.github
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Programs
Python
Tools
m4
.gitattributes -rw-r--r-- 1.5 KB
.gitignore -rw-r--r-- 1.5 KB
.travis.yml -rw-r--r-- 6.0 KB
CODE_OF_CONDUCT.rst -rw-r--r-- 631 bytes
LICENSE -rw-r--r-- 12.5 KB
Makefile.pre.in -rw-r--r-- 61.1 KB
README.rst -rw-r--r-- 9.9 KB
aclocal.m4 -rw-r--r-- 10.7 KB
config.guess -rwxr-xr-x 43.1 KB
config.sub -rwxr-xr-x 35.4 KB
configure -rwxr-xr-x 483.4 KB
configure.ac -rw-r--r-- 161.5 KB
install-sh -rwxr-xr-x 7.0 KB
pyconfig.h.in -rw-r--r-- 42.1 KB
setup.py -rw-r--r-- 99.5 KB

README.rst

back to top