Update of /cvsroot/jython/jython/Tools/jythonc
In directory usw-pr-cvs1:/tmp/cvs-serv16750
Modified Files:
PythonModule.py
Log Message:
Fix for [ #480390 ] main() does not throw exceptions.
Add a throw clause to the generated main() method. Also give a different
property lists to the initProxy() and the runMain(). In initProxy() we
still want to see java exception, in runMain() it is now the JVM that
prints the exception thrown from the main() method.
Index: PythonModule.py
===================================================================
RCS file: /cvsroot/jython/jython/Tools/jythonc/PythonModule.py,v
retrieving revision 2.15
retrieving revision 2.16
diff -C2 -d -r2.15 -r2.16
*** PythonModule.py 2001/11/21 11:24:22 2.15
--- PythonModule.py 2001/11/21 11:37:25 2.16
***************
*** 225,236 ****
! defaultProps = {
! ## now redundant
! ## "python.packages.paths": "",
! ## "python.packages.directories": "",
"python.options.showJavaExceptions": "true",
"python.modules.builtin": "exceptions:org.python.core.exceptions",
}
--- 225,237 ----
! defaultProxyProps = {
"python.options.showJavaExceptions": "true",
"python.modules.builtin": "exceptions:org.python.core.exceptions",
}
+ defaultMainProps = {
+ "python.modules.builtin": "exceptions:org.python.core.exceptions",
+ }
+
***************
*** 248,252 ****
def __init__(self, name, filename="<unknown>", packages = [],
! properties=defaultProps, frozen=1):
package = None
dot = name.rfind('.')
--- 249,254 ----
def __init__(self, name, filename="<unknown>", packages = [],
! proxyProperties=defaultProxyProps,
! mainProperties=defaultMainProps, frozen=1):
package = None
dot = name.rfind('.')
***************
*** 270,274 ****
self.packages = packages
! self.properties = properties
self.innerClasses = []
--- 272,277 ----
self.packages = packages
! self.proxyProperties = proxyProperties
! self.mainProperties = mainProperties
self.innerClasses = []
***************
*** 326,331 ****
#Properties and packages for registry
! def getProperties(self):
! return jast.Identifier("jpy$properties")
def getPackages(self):
--- 329,337 ----
#Properties and packages for registry
! def getMainProperties(self):
! return jast.Identifier("jpy$mainProperties")
!
! def getProxyProperties(self):
! return jast.Identifier("jpy$proxyProperties")
def getPackages(self):
***************
*** 340,344 ****
def dumpProperties(self):
! return self.dumpDictionary(self.properties, self.getProperties())
def dumpPackages(self):
--- 346,355 ----
def dumpProperties(self):
! return [
! self.dumpDictionary(self.mainProperties,
! self.getMainProperties()),
! self.dumpDictionary(self.proxyProperties,
! self.getProxyProperties())
! ]
def dumpPackages(self):
***************
*** 384,388 ****
self.name+'.'+self.pyinner.name), "class"),
jast.Identifier('newargs'),
! self.getPackages(), self.getProperties(),
self.getFrozen(), jast.StringArray(self.modules.keys())]
--- 395,399 ----
self.name+'.'+self.pyinner.name), "class"),
jast.Identifier('newargs'),
! self.getPackages(), self.getMainProperties(),
self.getFrozen(), jast.StringArray(self.modules.keys())]
***************
*** 390,394 ****
maincode = jast.Block(code)
meths.append(jast.Method("main", "public static",
! ["void", ("String[]", "args")], maincode))
return meths
--- 401,406 ----
maincode = jast.Block(code)
meths.append(jast.Method("main", "public static",
! ["void", ("String[]", "args")], maincode,
! ["java.lang.Exception"]))
return meths
|