You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
datetime: Tests for potential crashes due to non-UTF-8-encodable strings #78663
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2018-10-23.07:06:16.562>created_at=<Date2018-08-23.17:41:50.810>labels= ['type-security', 'extension-modules', '3.7', '3.8']
title='datetime: Tests for potential crashes due to non-UTF-8-encodable strings'updated_at=<Date2018-11-27.16:17:11.783>user='https://github.com/izbyshev'
This is a follow-up of bpo-34454. 'datetime' extension module attempts to encode input strings into UTF-8 in several places, which requires special care because some valid Python strings can't be represented in UTF-8. It makes sense to add more tests for methods dealing with strings.
Note that my PR doesn't attempt to deal with bpo-34481. In cases where behavior differs between C and Python datetime impls the tests check only for absence of crashes.
New changeset 3b0047d by Tal Einat (Alexey Izbyshev) in branch 'master': bpo-34482: test datetime classes' handling of non-UTF-8-encodable strings (GH-8878) 3b0047d
New changeset 313e501 by Miss Islington (bot) in branch '3.7': bpo-34482: test datetime classes' handling of non-UTF-8-encodable strings (GH-8878) 313e501
Activity
izbyshev commentedon Aug 23, 2018
This is a follow-up of bpo-34454. 'datetime' extension module attempts to encode input strings into UTF-8 in several places, which requires special care because some valid Python strings can't be represented in UTF-8. It makes sense to add more tests for methods dealing with strings.
Note that my PR doesn't attempt to deal with bpo-34481. In cases where behavior differs between C and Python datetime impls the tests check only for absence of crashes.
pganssle commentedon Aug 27, 2018
Somewhat related: bpo-6697.
Turns out there are already some tests here for this, specifically for the C version only: https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py#L3328
izbyshev commentedon Aug 28, 2018
Yes, I've referenced the relevant message from bpo-6697 in bpo-34454.
The specific test you've referenced should be changed after bpo-34481 is fixed -- it highlights inconsistency between C and Python implementations.
taleinat commentedon Oct 23, 2018
New changeset 3b0047d by Tal Einat (Alexey Izbyshev) in branch 'master':
bpo-34482: test datetime classes' handling of non-UTF-8-encodable strings (GH-8878)
3b0047d
miss-islington commentedon Oct 23, 2018
New changeset 313e501 by Miss Islington (bot) in branch '3.7':
bpo-34482: test datetime classes' handling of non-UTF-8-encodable strings (GH-8878)
313e501
taleinat commentedon Oct 23, 2018
Thanks for the PR, Alexey!
vstinner commentedon Nov 27, 2018
It seems like thie issue introduced a memory leak: bpo-35322 .
izbyshev commentedon Nov 27, 2018
The added test exposed a leak in unicode_encode_locale(). See msg330534.