mirror of
https://github.com/python/cpython.git
synced 2025-12-11 11:31:05 +00:00
use the stricter PyMapping_Check (closes #15801)
This commit is contained in:
parent
2412c93a60
commit
28a6cfaefc
3 changed files with 7 additions and 2 deletions
|
|
@ -1142,6 +1142,9 @@ class MixinStrUnicodeUserStringTest:
|
||||||
self.checkraises(TypeError, '%10.*f', '__mod__', ('foo', 42.))
|
self.checkraises(TypeError, '%10.*f', '__mod__', ('foo', 42.))
|
||||||
self.checkraises(ValueError, '%10', '__mod__', (42,))
|
self.checkraises(ValueError, '%10', '__mod__', (42,))
|
||||||
|
|
||||||
|
class X(object): pass
|
||||||
|
self.checkraises(TypeError, 'abc', '__mod__', X())
|
||||||
|
|
||||||
def test_floatformatting(self):
|
def test_floatformatting(self):
|
||||||
# float formatting
|
# float formatting
|
||||||
for prec in range(100):
|
for prec in range(100):
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ Core and Builtins
|
||||||
|
|
||||||
- Issue #15761: Fix crash when PYTHONEXECUTABLE is set on Mac OS X.
|
- Issue #15761: Fix crash when PYTHONEXECUTABLE is set on Mac OS X.
|
||||||
|
|
||||||
|
- Issue #15801: Make sure mappings passed to '%' formatting are actually
|
||||||
|
subscriptable.
|
||||||
|
|
||||||
- Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
|
- Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
|
||||||
Patch by Robin Schreiber.
|
Patch by Robin Schreiber.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9504,8 +9504,7 @@ PyObject *PyUnicode_Format(PyObject *format,
|
||||||
arglen = -1;
|
arglen = -1;
|
||||||
argidx = -2;
|
argidx = -2;
|
||||||
}
|
}
|
||||||
if (Py_TYPE(args)->tp_as_mapping && !PyTuple_Check(args) &&
|
if (PyMapping_Check(args) && !PyTuple_Check(args) && !PyUnicode_Check(args))
|
||||||
!PyUnicode_Check(args))
|
|
||||||
dict = args;
|
dict = args;
|
||||||
|
|
||||||
while (--fmtcnt >= 0) {
|
while (--fmtcnt >= 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue