[Python-Dev] Case-sensitive import
Tim Peters
tim.one@home.com
Wed, 28 Feb 2001 13:48:39 -0500
[Jack Jansen]
> Why don't we handle this the same way as, say, PyOS_CheckStack()?
>
> I.e. if USE_CHECK_IMPORT_CASE is defined it is necessary to check
> the case of the imported file (i.e. it's not defined on vanilla
> unix, defined on most other platforms) and if it is defined we call
> PyOS_CheckCase(filename, modulename).
> All these routines can be in different files, for all I care,
> similar to the dynload_*.c files.
A. I want the code in the CVS tree. That some of your Mac code is
not in the CVS tree creates problems for everyone (we can never
guess whether we're breaking your code because we have no idea
what your code is).
B. PyOS_CheckCase() is not of general use. It's only of interest
inside import.c, so it's better to live there as a static function.
C. I very much enjoyed getting rid of the obfuscating #ifdef
CHECK_IMPORT_CASE blocks in import.c! This code is hard enough to
follow without distributing preprocessor tricks all over the
place. Now they live only inside the body of case_ok(), where
they're truly needed. That is, case_ok() is a perfectly sensible
cross-platfrom abstraction, and *calling* code doesn't need to
be bothered with how it's implemented-- or even whether it's
needed --on various platfroms. On Linux, case_ok() reduces to
the one-liner "return 1;", and I don't mind paying a function
call in return for the increase in clarity inside find_module().
D. The schedule says we release the beta tomorrow <0.6 wink>.