summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorPaul Ganssle <pganssle@users.noreply.github.com>2018-08-23 15:06:20 (GMT)
committerTal Einat <taleinat+github@gmail.com>2018-08-23 15:06:20 (GMT)
commit096329f0b2bf5e3f0a16363aa631d993ce078737 (patch)
tree503291191bdb7ecd0d42d02bd8a35b72af468d81 /Misc
parentc33bb5d4016fb2fc8f3b6d4b0c14b73b33cdb3cf (diff)
downloadcpython-096329f0b2bf5e3f0a16363aa631d993ce078737.zip
cpython-096329f0b2bf5e3f0a16363aa631d993ce078737.tar.gz
cpython-096329f0b2bf5e3f0a16363aa631d993ce078737.tar.bz2
bpo-34454: fix .fromisoformat() methods crashing on inputs with surrogate code points (GH-8862)
The current C implementations **crash** if the input includes a surrogate Unicode code point, which is not possible to encode in UTF-8. Important notes: 1. It is possible to pass a non-UTF-8 string as a separator to the `.isoformat()` methods. 2. The pure-Python `datetime.fromisoformat()` implementation accepts strings with a surrogate as the separator. In `datetime.fromisoformat()`, in the special case of non-UTF-8 separators, this implementation will take a performance hit by making a copy of the input string and replacing the separator with 'T'. Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru> Co-authored-by: Paul Ganssle <paul@ganssle.io>
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2018-08-22-21-59-08.bpo-34454.z7uG4b.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2018-08-22-21-59-08.bpo-34454.z7uG4b.rst b/Misc/NEWS.d/next/Library/2018-08-22-21-59-08.bpo-34454.z7uG4b.rst
new file mode 100644
index 0000000..1d5c327
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-08-22-21-59-08.bpo-34454.z7uG4b.rst
@@ -0,0 +1,4 @@
+Fix the .fromisoformat() methods of datetime types crashing when given
+unicode with non-UTF-8-encodable code points. Specifically,
+datetime.fromisoformat() now accepts surrogate unicode code points used as
+the separator. Report and tests by Alexey Izbyshev, patch by Paul Ganssle.