[Python-Dev] Modules of plat-* directories

"Martin v. Löwis" martin at v.loewis.de
Sun Oct 23 23:50:26 CEST 2011


> I don't understand why we kept modules of the plat-* directories (e.g. 
> Lib/plat-linux/CDROM.py).

Because they are useful. There is no reasonable other way at getting at
the information in the modules for a Python program that may need them.

> These modules are not regenerated when Python is compiled, so I don't 
> understand how values can be correct.

They must be correct. On a specific system, these constants are not just
part of the API - they are part of the ABI. So a system vendor cannot
just change their values. Once defined, they must stay fixed forever.

That's why it's not necessary to regenerate the files.

> For example, IN.INT_MAX is 2147483647, 
> whereas it should be 9223372036854775807 on my 64-bit Linux. These values 
> don't look reliable.

In general, this system can't deal well with conditional defines. People
using them will know that.

> These modules contain non-working functions:
> 
> def __STRING(x): return #x                                                      
> def __constant_le32_to_cpu(x): return ((__u32)(__le32)(x))

So what? The whole point of h2py is that it is automatically generated.
If the output is bogus, users just won't use the fragments that are
bogus. Other fragments work just fine, and can be used.

Regards,
Martin


More information about the Python-Dev mailing list