[issue15753] No-argument super in method with variable arguments raises SystemError

2019-02-14 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2019-02-13 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
nosy: +remi.lapeyre

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2019-02-13 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Moving from pending back to open (not sure what was "pending" about it?).

The workaround is viable (and used by Python implemented dict subclasses in the 
standard library since they must accept **kwargs with arbitrary strings, 
including self), but it does seem a little silly that it's required. Leaving it 
as low priority since the workaround exists.

Still, would be nice to make super() seamless, pulling the first argument if 
the function accepts it as non-varargs, and the first element of the first 
argument if it's varargs. If someone reassigns self/args, that's on them; it's 
fine to raise a RuntimeError if they use no-arg super(), requiring them to use 
two-arg super explicitly in that case.

--
priority: normal -> low
status: pending -> open
versions: +Python 3.8 -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2016-05-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2015-06-20 Thread Martin Panter

Martin Panter added the comment:

The obvious workaround is to include an explicit “self” parameter (name 
shouldn’t matter):

def f(arbitrary, *positional, **most_keywords):
all_positional = (arbitrary,) + positional
...

If you need to reserve all keyword parameter names, you could try the manual 
version of super():

class A:
def f(*all_positional, **all_keywords):
print(super(A, all_positional[0]).__repr__())

--
nosy: +vadmium

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2015-02-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +benjamin.peterson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-09-02 Thread Andrew Svetlov

Andrew Svetlov added the comment:

BTW see #15839: super now raises RuntimeError.
After that I revoke my objection for exception type changing.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-08-26 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-08-25 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-08-24 Thread James

James added the comment:

It turns out I don't really understand how frame objects work.  My patch can 
crash python if you do this:

 class A:
... def f(*args):
... args = 1
... print(super())
... 
 A().f()
python: Objects/typeobject.c:6516: super_init: Assertion 
`((PyObject*)(obj))-ob_type))-tp_flags  ((1L26))) != 0)' failed.
Aborted

Is there a way of checking if the first argument has been overwritten, or do 
you just have to assume that if it is still a tuple, it hasn't been?  Should 
the super documentation mention that assigning to self (or args in this case) 
can make the no-argument version work incorrectly?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-08-24 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

The failing assertion is the assert(PyTuple_Check(obj)) added by your patch.
At this point, obj is not the arguments tuple, but the first entry in 
f-f_localsplus. Maybe this block should be moved a bit earlier?

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-08-24 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-08-24 Thread James

James added the comment:

Sorry, I wasn't very clear.  super() currently works by assuming that self is 
the first entry in f_localsplus, which is defeated, for example, by doing:

 class A:
... def f(self):
... del self
... super()
... 
 A().f()
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 4, in f
SystemError: super(): arg[0] deleted
 class B:
... def f(self):
... self = 1
... super()
... 
 B().f()
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 4, in f
TypeError: super(type, obj): obj must be an instance or subtype of type

I don't know if this is the intended behaviour (in which case, my assertion 
that obj is a tuple should be replaced by just checking whether it is a tuple 
and raising an exception otherwise; and I suppose the super documentation 
should mention this caveat), or whether this should be fixed somehow.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-08-24 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Changing exception type is not backward compatible and should be documented at 
least if that change is really required.
Personally I slightly prefer to leave SystemError untouched

--
nosy: +asvetlov

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-08-23 Thread James

James added the comment:

I've attached a patch that I think fixes the variable arguments problem, and 
changes the SystemErrors that can be obtained by misusing super() into 
RuntimeErrors (I assume that's more appropriate?).  There are three more 
SystemErrors I'm not sure about: super(): no code object, super(): bad 
__class__ cell, and super(): empty __class__ cell - can they only be caused 
by internal bugs?

--
keywords: +patch
Added file: http://bugs.python.org/file26976/issue15753_varargsuper.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-08-21 Thread James

New submission from James:

For example:

Python 3.2.2 (default, Feb 10 2012, 09:23:17) 
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type help, copyright, credits or license for more information.
 class A:
... def f(*args):
... print(super().__repr__())
... 
 A().f()
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 3, in f
SystemError: super(): no arguments

(There is no change in the current development version 3.3.0b2+)

I guess that the problem here is related to the fact that the super call makes 
sense if we call A().f() but not if we call A.f() (which is allowed by the 
method signature)?  I understand that not including self in the signature is 
almost always bad style, but occasionally it is necessary, for example if you 
want to allow arbitrary keyword arguments as dict.update does.

Also, how come using the no-argument form of super outside a method raises 
SystemError - isn't that supposed to be for internal errors?

--
components: Interpreter Core
messages: 168757
nosy: james.sanders
priority: normal
severity: normal
status: open
title: No-argument super in method with variable arguments raises SystemError
type: behavior
versions: Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15753] No-argument super in method with variable arguments raises SystemError

2012-08-21 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com