Issue222877

classification
Title: Cannot call superclass's __init__ if superclass is in a pack
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pedronis Nosy List: bckfnn, pedronis
Priority: low Keywords:

Created on 2000-11-18.19:48:15 by bckfnn, last changed 2000-11-28.12:21:25 by pedronis.

Messages
msg203 (view) Author: Finn Bock (bckfnn) Date: 2000-11-18.19:48:15
This is an elaboration of bug 263.

With the following Java class

package foobar
public class Super {
  public Super()
  {
    System.out.println("Hi from Super");
  }
}

if you try to run the following Python code:

from foobar import Super
class Sub(Super):
	def __init__(self):
		Super.__init__(self)

It does not work (assuming that the CLASSPATH is set correctly and all), but
emits
the error "TypeError: invalid self argument" at the line that calls
Super.__init__(self).

However, if the Java class Super is in a jar file, then the Python code works.
Also,
if you do not call the superclass constructor explicitly and let the runtime
system
do it, then it works.

This seems very strange to me, since although I can understand why finding
classes
might be different between jar vs. non-jar files (for example, it kind of makes
sense why you can't do "from mypackage import *" unless mypackage is in a jar
file),
I would have thought that once a class was found it would be treated
identically
whether it was in a jar file or not.
msg204 (view) Author: Samuele Pedroni (pedronis) Date: 2000-11-28.12:21:25
Instance of now fixed broken sys.path loading.
History
Date User Action Args
2000-11-18 19:48:15bckfnncreate