Mercurial > cpython-lru_cache-weakref
comparison Python/sysmodule.c @ 56715:aacee9749d15 legacy-trunk
Issue #7117 (backport py3k float repr) continued:
Add sys.float_repr_style attribute ('short' if short float
repr is in used; 'legacy' otherwise).
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Sat, 24 Oct 2009 14:01:08 +0000 |
| parents | 164d64b39ac0 |
| children | bc2b88beae45 |
comparison
equal
deleted
inserted
replaced
| 56713:06e6636618d7 | 56715:aacee9749d15 |
|---|---|
| 1054 copyright -- copyright notice pertaining to this interpreter\n\ | 1054 copyright -- copyright notice pertaining to this interpreter\n\ |
| 1055 platform -- platform identifier\n\ | 1055 platform -- platform identifier\n\ |
| 1056 executable -- pathname of this Python interpreter\n\ | 1056 executable -- pathname of this Python interpreter\n\ |
| 1057 prefix -- prefix used to find the Python library\n\ | 1057 prefix -- prefix used to find the Python library\n\ |
| 1058 exec_prefix -- prefix used to find the machine-specific Python library\n\ | 1058 exec_prefix -- prefix used to find the machine-specific Python library\n\ |
| 1059 float_repr_style -- string indicating the style of repr() output for floats\n\ | |
| 1059 " | 1060 " |
| 1060 ) | 1061 ) |
| 1061 #ifdef MS_WINDOWS | 1062 #ifdef MS_WINDOWS |
| 1062 /* concatenating string here */ | 1063 /* concatenating string here */ |
| 1063 PyDoc_STR( | 1064 PyDoc_STR( |
| 1495 PyStructSequence_InitType(&FlagsType, &flags_desc); | 1496 PyStructSequence_InitType(&FlagsType, &flags_desc); |
| 1496 SET_SYS_FROM_STRING("flags", make_flags()); | 1497 SET_SYS_FROM_STRING("flags", make_flags()); |
| 1497 /* prevent user from creating new instances */ | 1498 /* prevent user from creating new instances */ |
| 1498 FlagsType.tp_init = NULL; | 1499 FlagsType.tp_init = NULL; |
| 1499 FlagsType.tp_new = NULL; | 1500 FlagsType.tp_new = NULL; |
| 1501 | |
| 1502 /* float repr style: 0.03 (short) vs 0.029999999999999999 (legacy) */ | |
| 1503 #ifndef PY_NO_SHORT_FLOAT_REPR | |
| 1504 SET_SYS_FROM_STRING("float_repr_style", | |
| 1505 PyString_FromString("short")); | |
| 1506 #else | |
| 1507 SET_SYS_FROM_STRING("float_repr_style", | |
| 1508 PyString_FromString("legacy")); | |
| 1509 #endif | |
| 1500 | 1510 |
| 1501 #undef SET_SYS_FROM_STRING | 1511 #undef SET_SYS_FROM_STRING |
| 1502 if (PyErr_Occurred()) | 1512 if (PyErr_Occurred()) |
| 1503 return NULL; | 1513 return NULL; |
| 1504 return m; | 1514 return m; |
