What is the RIGHT way to patch python modules for jython?

Steve Cohen cohsteve at attbi.com
Mon Jan 7 07:45:44 EST 2002


I am working on a patch to cmd.py that would allow the command 
interpreters based on cmd.py to work with the JavaReadline system that 
is now a part of jython.  Without that, on some systems, the jython 
console is unable to have readline functionality such as command history.

In doing my patch, I mistakenly assumed that cmd.py was a part of the 
jython distribution rather than the python distribution.  My fixes work 
for me, but undoubtedly they will not be deemed suitable by the 
maintainers of python since they assume jython support.  I have two 
questions, since I am sure this must have come up before?

1)  What is the RIGHT way to patch python modules to allow special hooks 
needed for jython?  I assume the import statements must be within 
conditionals, right?  Anything else I need to be aware of?  Code samples?

2)  Jython works by referring to a registry file.  Does python also do 
this?  If not, is there a way to independently reference system 
properties regardless of whether they come from a registry file, 
enviroment variables, or some other source?

Thank you.




More information about the Python-list mailing list