mirror of
https://github.com/python/cpython.git
synced 2025-08-24 10:45:53 +00:00
gh-117642: Fix PEP 737 implementation (GH-117643)
* Fix implementation of %#T and %#N (they were implemented as %T# and %N#). * Restore tests removed in gh-116417.
This commit is contained in:
parent
1a6594f661
commit
24a2bd0481
5 changed files with 42 additions and 8 deletions
|
@ -2468,6 +2468,7 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
|
|||
switch (*f++) {
|
||||
case '-': flags |= F_LJUST; continue;
|
||||
case '0': flags |= F_ZERO; continue;
|
||||
case '#': flags |= F_ALT; continue;
|
||||
}
|
||||
f--;
|
||||
break;
|
||||
|
@ -2797,9 +2798,8 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
|
|||
PyTypeObject *type = (PyTypeObject *)Py_NewRef(Py_TYPE(obj));
|
||||
|
||||
PyObject *type_name;
|
||||
if (f[1] == '#') {
|
||||
if (flags & F_ALT) {
|
||||
type_name = _PyType_GetFullyQualifiedName(type, ':');
|
||||
f++;
|
||||
}
|
||||
else {
|
||||
type_name = PyType_GetFullyQualifiedName(type);
|
||||
|
@ -2830,9 +2830,8 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
|
|||
PyTypeObject *type = (PyTypeObject*)type_raw;
|
||||
|
||||
PyObject *type_name;
|
||||
if (f[1] == '#') {
|
||||
if (flags & F_ALT) {
|
||||
type_name = _PyType_GetFullyQualifiedName(type, ':');
|
||||
f++;
|
||||
}
|
||||
else {
|
||||
type_name = PyType_GetFullyQualifiedName(type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue