Issue2118

classification
Title: struct.Struct exposed as a function instead of a class
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: dooble, indra, zyasoft
Priority: Keywords:

Created on 2014-03-15.01:17:09 by dooble, last changed 2014-05-21.20:36:51 by zyasoft.

Messages
msg8252 (view) Author: dooble (dooble) Date: 2014-03-15.01:17:07
struct.Struct is a class, but exposed by jython as a function, which is inconsistent with CPython.

latest revision Jython:

Jython 2.7b1+ (, Mar 14 2014, 20:46:52)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_45
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> type(struct.Struct)
<type 'reflectedfunction'>
>>> class Example(struct.Struct): pass
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Error when calling the metaclass bases
    reflectedfunction(): expected 1 args; got 3
>>>


CPython 2.7.6:

Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> type(struct.Struct)
<type 'type'>
>>> class Example(struct.Struct): pass
...
>>>
msg8260 (view) Author: Indra Talip (indra) Date: 2014-03-22.03:39:31
Made org.python.modules.struct implement ClassDictInit and exposed PyStruct from struct as struct.Struct, pull request at https://bitbucket.org/jython/jython/pull-request/28/fix-the-struct-module-so-that-structstruct/diff
msg8354 (view) Author: Jim Baker (zyasoft) Date: 2014-05-09.22:12:41
Fixed in 7227:0431ab4d1e44
msg8463 (view) Author: Jim Baker (zyasoft) Date: 2014-05-21.20:36:51
Part of beta 3
History
Date User Action Args
2014-05-21 20:36:51zyasoftsetstatus: pending -> closed
messages: + msg8463
2014-05-09 22:12:46zyasoftsetstatus: open -> pending
2014-05-09 22:12:41zyasoftsetresolution: fixed
messages: + msg8354
nosy: + zyasoft
2014-03-22 03:39:31indrasetnosy: + indra
messages: + msg8260
2014-03-15 01:17:10dooblecreate