Message401700
> I think that would require some major surgery to the code, but would be worth it.
I've decided to take an easy path: https://github.com/python/cpython/pull/28310
```
PyErr_Format(PyExc_ValueError,
"Invalid format specifier: '%s' for object of type '%s'",
PyUnicode_AsUTF8AndSize(format_spec, NULL),
Py_TYPE(obj)->tp_name);
```
This worked for me as the starting point. It covered: int, float, complex, and str types.
> Note that in your original example, you want the error to contain "{length:%HH:%MM}". By the time the error is detected, the only thing the code knows is the format specifier "%HH:%MM". It doesn't know the "length" part.
I guess it has changed since the 2014.
I would love to hear any feedback on my proposal and improve it to the level when it can be merged :) |
|
Date |
User |
Action |
Args |
2021-09-13 12:04:47 | sobolevn | set | recipients:
+ sobolevn, eric.smith, ezio.melotti, r.david.murray, iritkatriel |
2021-09-13 12:04:47 | sobolevn | set | messageid: <1631534687.43.0.000320141127271.issue20524@roundup.psfhosted.org> |
2021-09-13 12:04:47 | sobolevn | link | issue20524 messages |
2021-09-13 12:04:47 | sobolevn | create | |
|