[issue4322] function with modified __name__ uses original name when there's an arg error

2021-11-26 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11: 

>>> def foo(): pass
... 
>>> foo.__name__ = 'bar'
>>> foo(1)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: foo() takes 0 positional arguments but 1 was given

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.4

___
Python tracker 

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



[issue4322] function with modified __name__ uses original name when there's an arg error

2015-09-02 Thread Martin Panter

Martin Panter added the comment:

Issue 2786 currently proposes to pass __qualname__; if accepted that might also 
satisfy this report.

--
dependencies: +Names in function call exception should have class names, if 
they're methods
nosy: +martin.panter

___
Python tracker 

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



[issue4322] function with modified __name__ uses original name when there's an arg error

2015-06-20 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag

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



[issue4322] function with modified __name__ uses original name when there's an arg error

2014-03-11 Thread R. David Murray

R. David Murray added the comment:

The 'Ex' generally means this is a public API but we needed to change it, so 
we made a new function with an extended API.  Which means yours would be 
PyEval_EvalCodeExEx, I suppose :)

Seriously, though, I don't know what we actually do in a case like this.  I 
don't touch the C code very often myself.  Hopefully Benjamin will find time to 
take a look.

--
nosy: +r.david.murray

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



[issue4322] function with modified __name__ uses original name when there's an arg error

2014-03-09 Thread Michele dos Santos da Silva

Michele dos Santos da Silva added the comment:

func_name was not available on the places where the error strings are set 
(PyErr_Format), so I added it and passed it around as needed.

This is the simplest approach, but I am not sure it is the best (newbie here). 
Thus, I am waiting for your comments to improve the solution.

pjenvey noted I cannot just change PyEval_EvalCodeEx, since it is part of the 
interface. I intend to write a new function and call it from the old interface, 
setting func_name to co_name.

Before I do that, I want to check if this design is correct. Also, I am not 
sure what this new function would be called, I am not even sure what the Ex 
means in PyEval_EvalCodeEx.

--
keywords: +patch
nosy: +mchelem
Added file: http://bugs.python.org/file34318/issue4322.patch

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



[issue4322] function with modified __name__ uses original name when there's an arg error

2013-08-04 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I think fixing this is a valid request.

--
resolution: invalid - 
status: closed - open

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



[issue4322] function with modified __name__ uses original name when there's an arg error

2013-08-04 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea
stage: committed/rejected - needs patch

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



[issue4322] function with modified __name__ uses original name when there's an arg error

2013-08-04 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
versions: +Python 3.4 -Python 3.0

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



[issue4322] function with modified __name__ uses original name when there's an arg error

2010-12-21 Thread R. David Murray

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


--
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

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



[issue4322] function with modified __name__ uses original name when there's an arg error

2008-11-14 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

This is because these errors use the code object's name attribute
(f.func_code.co_name) for error messages.

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

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



[issue4322] function with modified __name__ uses original name when there's an arg error

2008-11-13 Thread Erick Tryzelaar

New submission from Erick Tryzelaar [EMAIL PROTECTED]:

I ran into a case where I modified the __name__ attribute of a function 
and then didn't specify the right number of arguments, and I got a 
TypeError that used the original function name, as demonstrated here:

 def foo(): pass
... 
 foo.__name__ = 'bar'
 foo(1)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: foo() takes no arguments (1 given)

I would have expected it to say TypeError: bar()  I'm guessing 
that the interpreter isn't using the __name__ attribute in this case.

--
components: Library (Lib)
messages: 75853
nosy: erickt
severity: normal
status: open
title: function with modified __name__ uses original name when there's an arg 
error
type: behavior
versions: Python 3.0

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