Issue2231

classification
Title: __doc__ of PyString objects is always "The most base type" (bug in expose-mechanism?)
Type: Severity: major
Components: Core Versions: Jython 2.7
Milestone:
process
Status: pending Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jeff.allen, stefan.richthofer
Priority: normal Keywords:

Created on 2014-11-19.01:53:46 by stefan.richthofer, last changed 2018-03-16.22:39:01 by jeff.allen.

Messages
msg9212 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2014-11-19.01:53:45
test0 = "test"
print test0.__doc__
print type(test0)


It should print (and does so in CPython):
str(object='') -> string

Return a nice string representation of the object.
If the argument is a string, the return value is the same object.


But it *does* print:
The most base type


Looking at the Java code everything looks fine. The expose-line of PyString reads
@ExposedType(name = "str", doc = BuiltinDocs.str_doc)
which should be correct I suppose.
With PyUnicode an equal line works perfectly well. In PyString case it somehow delegates the expose line to PyObject, but I can't see why.
Adding base = PyBaseString.class does not fix it. Any ideas?

I would not bother if the doc of PyString would just be wrong, but this might indicate a bug in the expose-mechanism, so I set severity to "major". Maybe this affects other exposes as well.
msg11811 (view) Author: Jeff Allen (jeff.allen) Date: 2018-03-16.22:39:00
This is not now reproduced in v2.7.2a1:

PS bugs> jython
Jython 2.7.2a1+ (default:d74f8c2cd56f, Feb 24 2018, 17:18:53)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_151
Type "help", "copyright", "credits" or "license" for more information.
>>> test0 = "test"
>>> print test0.__doc__
str(object) -> string

Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
>>>

I will claim this as another beneficial side effect of recent work that rationalised PyType. Here, perhaps:
https://hg.python.org/jython/rev/55756721fa02#l8.677
History
Date User Action Args
2018-03-16 22:39:01jeff.allensetpriority: normal
status: open -> pending
resolution: fixed
messages: + msg11811
nosy: + jeff.allen
2014-11-19 01:53:47stefan.richthofercreate