Message86170
| Author |
mark.dickinson |
| Recipients |
eric.smith, mark.dickinson |
| Date |
2009年04月19日.12:57:44 |
| SpamBayes Score |
3.4691083e-11 |
| Marked as misclassified |
No |
| Message-id |
<1240145867.12.0.0306505871305.issue5793@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Problem: the standard C character handling functions from ctype.h
(isalpha, isdigit, isxdigit, isspace, toupper, tolower, etc.) are locale
aware, but for almost all uses CPython needs locale-unaware versions of
these.
There are various solutions in the current source:
- there's a file Include/bytes_methods.h which provides suitable
ISDIGIT/ISALPHA/... macros, but also undefines the standard functions.
As it is, it can't be included in Python.h since that would break
3rd party code that includes Python.h and also uses isdigit.
- some files have their own solution: Python/pystrtod.c defines
its own (probably inefficient) ISDIGIT and ISSPACE macros.
- in some places the standard C functions are just used directly (and
possibly incorrectly). A gotcha here is that one has to remember to use
Py_CHARMASK to avoid errors on some platforms. (See issue 3633 for an
example.)
It would be nice to clean all this up, and have one central, efficient,
easy-to-use set of Py_ISDIGIT/Py_ISALPHA ... locale-independent macros (or
functions) that could be used safely throughout the Python source. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年04月19日 12:57:47 | mark.dickinson | set | recipients:
+ mark.dickinson, eric.smith |
| 2009年04月19日 12:57:47 | mark.dickinson | set | messageid: <1240145867.12.0.0306505871305.issue5793@psf.upfronthosting.co.za> |
| 2009年04月19日 12:57:45 | mark.dickinson | link | issue5793 messages |
| 2009年04月19日 12:57:44 | mark.dickinson | create |
|