mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
#3303: fix crash with invalid Py_DECREF in strcoll().
This commit is contained in:
parent
6b41a8e156
commit
278fc50c07
3 changed files with 22 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
from test.test_support import verbose, TestSkipped
|
from test.test_support import verbose, TestSkipped, TestFailed
|
||||||
import locale
|
import locale
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -113,3 +113,12 @@ else:
|
||||||
teststrop('\xed\x95\xa0', 'upper', '\xed\x95\xa0')
|
teststrop('\xed\x95\xa0', 'upper', '\xed\x95\xa0')
|
||||||
finally:
|
finally:
|
||||||
locale.setlocale(locale.LC_CTYPE, oldlocale)
|
locale.setlocale(locale.LC_CTYPE, oldlocale)
|
||||||
|
|
||||||
|
if hasattr(locale, "strcoll"):
|
||||||
|
# test crasher from bug #3303
|
||||||
|
try:
|
||||||
|
locale.strcoll(u"a", None)
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise TestFailed("TypeError not raised")
|
||||||
|
|
16
Misc/NEWS
16
Misc/NEWS
|
@ -56,17 +56,20 @@ Core and Builtins
|
||||||
slice(None, 10, -1).indices(10) returns (9, 9, -1) instead of (9,
|
slice(None, 10, -1).indices(10) returns (9, 9, -1) instead of (9,
|
||||||
10, -1).
|
10, -1).
|
||||||
|
|
||||||
- Issue #3219: Calling a function with repeated keyword arguments, f(a=2, a=23),
|
- Issue #3219: Calling a function with repeated keyword arguments,
|
||||||
would not cause a syntax error. This was a regression from 2.4 caused by the
|
f(a=2, a=23), would not cause a syntax error. This was a regression
|
||||||
switch to the new compiler.
|
from 2.4 caused by the switch to the new compiler.
|
||||||
|
|
||||||
- Issue #2862: Make int and float freelist management consistent with other
|
- Issue #2862: Make int and float freelist management consistent with
|
||||||
freelists. Changes their CompactFreeList apis into ClearFreeList apis and
|
other freelists. Changes their CompactFreeList apis into
|
||||||
calls them via gc.collect().
|
ClearFreeList apis and calls them via gc.collect().
|
||||||
|
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #3303: Fix a crash in locale.strcoll() when calling it with
|
||||||
|
invalid arguments.
|
||||||
|
|
||||||
- Issue #3302: Fix several crashes when calling locale's gettext functions
|
- Issue #3302: Fix several crashes when calling locale's gettext functions
|
||||||
with None arguments.
|
with None arguments.
|
||||||
|
|
||||||
|
@ -145,7 +148,6 @@ Tests
|
||||||
and is now better documented. Explicit unit tests for this context manager
|
and is now better documented. Explicit unit tests for this context manager
|
||||||
have been added to test_warnings.
|
have been added to test_warnings.
|
||||||
|
|
||||||
|
|
||||||
Build
|
Build
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|
|
@ -301,7 +301,9 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
|
||||||
if (!PyUnicode_Check(os2)) {
|
if (!PyUnicode_Check(os2)) {
|
||||||
os2 = PyUnicode_FromObject(os2);
|
os2 = PyUnicode_FromObject(os2);
|
||||||
if (!os2) {
|
if (!os2) {
|
||||||
|
if (rel1) {
|
||||||
Py_DECREF(os1);
|
Py_DECREF(os1);
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
rel2 = 1;
|
rel2 = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue