[issue2516] Instance methods are misreporting the number of arguments

2021-11-23 Thread Irit Katriel


Irit Katriel  added the comment:

This seems to have been fixed by now, on 3.11 I get this:

>>> class A:
... def foo(self, x): pass
... 
>>> A().foo()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: A.foo() missing 1 required positional argument: 'x'

--
nosy: +iritkatriel
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue2516] Instance methods are misreporting the number of arguments

2013-08-17 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang
versions: +Python 3.4 -Python 3.2

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



[issue2516] Instance methods are misreporting the number of arguments

2012-12-11 Thread Éric Araujo

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


--
nosy: +eric.araujo

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Here is a similar issue which may be easier to fix:


 def f(a, b=None, *, c=None, d=None):
...pass


 f(1,2,3)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: f() takes at most 4 arguments (3 given)


Should be f() takes at most 2 positional arguments (3 given)

--

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
assignee: belopolsky - 

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Fixed in r82220.

--

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

Maybe I'm misunderstanding what issue we're talking about here, but wasn't this 
supposed to be fixed?


giampa...@ubuntu:~/svn/python-3.2$ python3.2
Python 3.2a0 (py3k:82220M, Jun 25 2010, 21:38:56) 
[GCC 4.4.3] on linux2
Type help, copyright, credits or license for more information.
 class A:
... def foo(self, x):
... pass
... 
 A().foo()
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: foo() takes exactly 2 arguments (1 given)


--

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-25 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I presume Benjamin meant he fixed the special case Alexander reported.

--

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-20 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

The same subject on python-dev raised last month received positive feedbacks:
http://mail.python.org/pipermail/python-dev/2010-May/100197.html

--
nosy: +giampaolo.rodola

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-20 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

All that is needed now is a working patch... :)

--
nosy: +r.david.murray

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-20 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
versions: +Python 3.2 -Python 2.6

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-05 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


Removed file: http://bugs.python.org/file14759/unnamed

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



[issue2516] Instance methods are misreporting the number of arguments

2010-06-05 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

gungor: your messages look mangled.  It may be the case of email to trucker 
bug.  Can you briefly explain what you are trying to add to the discussion?

--
assignee:  - belopolsky

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



[issue2516] Instance methods are misreporting the number of arguments

2010-05-28 Thread Rodrigo Bernardo Pimentel

Changes by Rodrigo Bernardo Pimentel r...@isnomore.net:


--
nosy: +rbp

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



[issue2516] Instance methods are misreporting the number of arguments

2009-08-21 Thread gungor

gungor gungorb...@gmail.com added the comment:

I am using Django with python to develope a web application.While I am
trying to syncronize and running the localserver, I get this issue(2516).
problem function is cagri()
Source Code:
from django.db import models
from datetime import datetime
from sets import ImmutableSet

class Randevu(models.Model):
def __init__(self):

saatler=(
('8',(8)),
('9',(9)),
('10',(10)),
('11',(11)),
('13',(13)),
('14',(14)),
('15',(15)),
('16',(16)),
)


ad=models.CharField(max_length=30)
soyad=models.CharField(max_length=30)
tarih=models.DateField()
saat=models.TimeField(choices=saatler)
konu=models.TextField()
email=models.EmailField()
t=cagri()
t.cagir(saat)
#r=Randevu()
class duzen():
def duz(saat):
r=Randevu()
fil=r.objects.filter(tarih__gte=datetime(2009,8,21))
for saat in fil:
if saat==fil.saat:
error() 
class cagri():
def cagir(saat):
d=duzen()
d.duz(saat)

--
components:  -Interpreter Core
nosy: +gungorbasa
type: behavior - compile error
versions: +Python 2.6

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



[issue2516] Instance methods are misreporting the number of arguments

2009-08-21 Thread gungor

gungor gungorb...@gmail.com added the comment:

TypeError at /admin/rt/randevu/add/

cagir() takes exactly 1 argument (2 given)

 Request Method: GET  Request URL:
http://127.0.0.1:8000/admin/rt/randevu/add/  Exception Type: TypeError
 Exception
Value:

cagir() takes exactly 1 argument (2 given)

 Exception Location: /home/gungor/rts/../rts/rt/models.py in __init__, line
27  Python Executable: /usr/bin/python  Python Version: 2.6.2  Python
Path: ['/home/gungor/rts',
'/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages/PIL',
'/usr/lib/python2.6/dist-packages/gst-0.10',
'/var/lib/python-support/python2.6',
'/usr/lib/python2.6/dist-packages/gtk-2.0',
'/var/lib/python-support/python2.6/gtk-2.0',
'/usr/local/lib/python2.6/dist-packages']  Server time: Fri, 21 Aug 2009
07:24:43 -0500
2009/8/21 Benjamin Peterson rep...@bugs.python.org


 Changes by Benjamin Peterson benja...@python.org:


 --
 type: compile error - feature request

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue2516
 ___


--
Added file: http://bugs.python.org/file14758/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2516
___span class=gI/spanbrh1TypeError at /admin/rt/randevu/add//h1
  pre class=exception_valuecagir() takes exactly 1 argument (2 given)/pre
  
table class=metatbodytr
  thRequest Method:/th
  tdGET/td
/tr
tr
  thRequest URL:/th
  tda 
href=http://127.0.0.1:8000/admin/rt/randevu/add/;http://127.0.0.1:8000/admin/rt/randevu/add//a/td
/tr
tr
  thException Type:/th
  tdTypeError/td
/tr
tr
  thException Value:/th
  tdprecagir() takes exactly 1 argument (2 given)/pre/td
/tr
tr
  thException Location:/th
  td/home/gungor/rts/../rts/rt/models.py in __init__, line 27/td
/tr
tr
  thPython Executable:/th
  td/usr/bin/python/td
/tr
tr
  thPython Version:/th
  td2.6.2/td
/tr
tr
  thPython Path:/th
  td[#39;/home/gungor/rts#39;,
#39;/usr/lib/python2.6#39;, #39;/usr/lib/python2.6/plat-linux2#39;,
#39;/usr/lib/python2.6/lib-tk#39;, #39;/usr/lib/python2.6/lib-old#39;,
#39;/usr/lib/python2.6/lib-dynload#39;, 
#39;/usr/lib/python2.6/dist-packages#39;,
#39;/usr/lib/python2.6/dist-packages/PIL#39;,
#39;/usr/lib/python2.6/dist-packages/gst-0.10#39;,
#39;/var/lib/python-support/python2.6#39;,
#39;/usr/lib/python2.6/dist-packages/gtk-2.0#39;,
#39;/var/lib/python-support/python2.6/gtk-2.0#39;,
#39;/usr/local/lib/python2.6/dist-packages#39;]/td
/tr
tr
  thServer time:/th
  tdFri, 21 Aug 2009 07:24:43 -0500/td/tr/tbody/tablebrdiv 
class=gmail_quote2009/8/21 Benjamin Peterson span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/spanbr
blockquote class=gmail_quote style=border-left: 1px solid rgb(204, 204, 
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;br
Changes by Benjamin Peterson lt;a 
href=mailto:benja...@python.org;benja...@python.org/agt;:br
br
br
--br
type: compile error -gt; feature requestbr
divdiv/divdiv class=h5br
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
lt;a href=http://bugs.python.org/issue2516; 
target=_blankhttp://bugs.python.org/issue2516/agt;br
___br
/div/div/blockquote/divbrbr clear=allbr
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2516] Instance methods are misreporting the number of arguments

2009-08-21 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
type: compile error - feature request

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



[issue2516] Instance methods are misreporting the number of arguments

2009-08-21 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


Removed file: http://bugs.python.org/file14758/unnamed

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



[issue2516] Instance methods are misreporting the number of arguments

2009-08-21 Thread gungor

gungor gungorb...@gmail.com added the comment:

I don't understand your message.You only send me my error message's xml
version

2009/8/21 Benjamin Peterson rep...@bugs.python.org


 Changes by Benjamin Peterson benja...@python.org:


 Removed file: http://bugs.python.org/file14758/unnamed

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue2516
 ___


--
Added file: http://bugs.python.org/file14759/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2516
___I don#39;t understand your message.You only send me my error message#39;s xml 
versionbrbrdiv class=gmail_quote2009/8/21 Benjamin Peterson span 
dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/spanbr
blockquote class=gmail_quote style=border-left: 1px solid rgb(204, 204, 
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;div class=imbr
Changes by Benjamin Peterson lt;a 
href=mailto:benja...@python.org;benja...@python.org/agt;:br
br
br
/divRemoved file: a href=http://bugs.python.org/file14758/unnamed; 
target=_blankhttp://bugs.python.org/file14758/unnamed/abr
div class=imbr
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
/divdiv class=imlt;a href=http://bugs.python.org/issue2516; 
target=_blankhttp://bugs.python.org/issue2516/agt;br
/div___br
/blockquote/divbrbr clear=allbr-- bra 
href=http://www.ral.forumup.com;www.ral.forumup.com/abr
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2516] Instance methods are misreporting the number of arguments

2009-08-21 Thread Guido van Rossum

Changes by Guido van Rossum gu...@python.org:


--
nosy:  -gvanrossum

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



[issue2516] Instance methods are misreporting the number of arguments

2008-04-04 Thread Alexander Belopolsky

Alexander Belopolsky [EMAIL PROTECTED] added the comment:

On Thu, Apr 3, 2008 at 9:39 PM, Raymond Hettinger
[EMAIL PROTECTED] wrote:

 It's definitely a bug

What would you say to the following:

def f(x):
pass
class X:
xf = f

x = X()
x.xf(1,2)

-- TypeError: f() takes exactly 1 argument (3 given)

Is this correct?

..
  I was hoping for something along the lines of functions raising an
  ArgumentError (a new subclass of TypeError) that could be trapped by
  the __call__ slot for bound methods and then reraised with a new
  argument count.

This would be my first choice for a clean solution as well.  Since it
will require a change to the exception hierarchy, should we discuss a
modification to PEP 348 on python-dev?   I would rather finish the
patch first and then make a concrete proposal.

 The key is to find a *very* lightweight and minimal solution;

.. according to what metric?  Are you talking about the amount of code
that needs to be changed, the number of API changes or run-time
overhead?  I don't think run-time overhead is an issue: argument
errors are rarely used for flow control  because it is hard to predict
what a failed attempt to call a function would do.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2516
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2516] Instance methods are misreporting the number of arguments

2008-04-03 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

Guido, what's your opinion on this? Is this a bug, and should it be fixed?

--
nosy: +gvanrossum

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2516
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2516] Instance methods are misreporting the number of arguments

2008-04-03 Thread Raymond Hettinger

Raymond Hettinger [EMAIL PROTECTED] added the comment:

It's definitely a bug, but I think the reason it has been around so 
long is that no-one has offerred a clean solution.  

I was hoping for something along the lines of functions raising an 
ArgumentError (a new subclass of TypeError) that could be trapped by 
the __call__ slot for bound methods and then reraised with a new 
argument count.  The key is to find a *very* lightweight and minimal 
solution; otherwise, we should just live with it for another 18 years :-
)

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2516
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2516] Instance methods are misreporting the number of arguments

2008-03-30 Thread Alexander Belopolsky

New submission from Alexander Belopolsky [EMAIL PROTECTED]:

Opening a new issue per Raymond's request at msg64764:


It would be *much* more useful to direct effort improving the mis-
reporting of the number of arguments given versus those required for
instance methods:
   a.f(1, 2)
  TypeError: f() takes exactly 1 argument (3 given)


I would suggest that this misreporting may be dear to old-beards 
reminding the time when there was not as much difference between methods 
and functions as there is now.

It does not seem to be that hard to change the diagnostic to 

   a.f(1, 2)
  TypeError: f() takes no arguments (2 given)

but the novice users would much rather see a.f() takes no arguments (2 
given). The later is unfortunately not possible.

Raymond, what would you say to class 'A' instance.f() takes no 
arguments (2 given) diagnostic?

--
components: Interpreter Core
messages: 64767
nosy: belopolsky, rhettinger
severity: normal
status: open
title: Instance methods are misreporting the number of arguments
type: behavior

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2516
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2516] Instance methods are misreporting the number of arguments

2008-03-30 Thread Ned Batchelder

Changes by Ned Batchelder [EMAIL PROTECTED]:


--
nosy: +nedbat

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2516
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2516] Instance methods are misreporting the number of arguments

2008-03-30 Thread Alexander Belopolsky

Alexander Belopolsky [EMAIL PROTECTED] added the comment:

Attached patch (issue2516poc.diff) presents proof-of-concept code which 
changes the problematic reporting as follows:

 a.f(1,2)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: A object.f() takes exactly 0 arguments (2 given)

More effort is needed to make this patch ready: support default/keyword 
arguments, respect English grammar in 1-argument case, etc.  Before I do 
that, however, I would like to hear that this is a worthwhile fix and 
that I've chosen the right place in the code to implement it.

--
keywords: +patch
Added file: http://bugs.python.org/file9908/issue2516poc.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2516
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2516] Instance methods are misreporting the number of arguments

2008-03-30 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

You have +1 from me to continue developing this patch.

--
nosy: +benjamin.peterson
priority:  - low

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2516
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com