[issue29924] Useless argument in call to PyErr_Format

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:

Thank you SylvainDe, I merged your fix!

About the GCC __attribute__ idea: I'm not sure, since Python uses some extra 
formatters (I don't recall which one). If you succeed to write something 
working, please open a new issue!

Since the initial bug is fixed, I close the issue now.

--
resolution:  -> fixed
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



[issue29924] Useless argument in call to PyErr_Format

2017-03-27 Thread STINNER Victor

STINNER Victor added the comment:


New changeset d67a103702cf57de90a62c90f7ae969c23d96218 by Victor Stinner 
(Sylvain) in branch 'master':
bpo-29924: Remove useless argument (#854)
https://github.com/python/cpython/commit/d67a103702cf57de90a62c90f7ae969c23d96218


--
nosy: +haypo

___
Python tracker 

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



[issue29924] Useless argument in call to PyErr_Format

2017-03-27 Thread SylvainDe

SylvainDe added the comment:

Seems to be introduced via 250e4b0063fab35770719b64d1e36209c4aa2596 in January 
this year.

--

___
Python tracker 

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



[issue29924] Useless argument in call to PyErr_Format

2017-03-27 Thread Larry Hastings

Changes by Larry Hastings :


--
nosy:  -larry

___
Python tracker 

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



[issue29924] Useless argument in call to PyErr_Format

2017-03-27 Thread Larry Hastings

Larry Hastings added the comment:

This is not an Argument Clinic issue.

--
components: +Interpreter Core -Argument Clinic

___
Python tracker 

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



[issue29924] Useless argument in call to PyErr_Format

2017-03-27 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +755

___
Python tracker 

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



[issue29924] Useless argument in call to PyErr_Format

2017-03-27 Thread SylvainDe

SylvainDe added the comment:

http://julio.meroh.net/2011/06/validating-format-strings-in-custom-c.html

--

___
Python tracker 

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



[issue29924] Useless argument in call to PyErr_Format

2017-03-27 Thread SylvainDe

SylvainDe added the comment:

I forgot to copy the link but here is a description of what I had in mind for 
the first idea.

--

___
Python tracker 

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



[issue29924] Useless argument in call to PyErr_Format

2017-03-27 Thread SylvainDe

New submission from SylvainDe:

Very uninteresting issue I've found while looking at the code.

In Objects/call.c, in _PyMethodDef_RawFastCallDict(PyMethodDef *method, 
PyObject *self, PyObject **arg...), we have


   no_keyword_error:
   PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
method->ml_name, nargs);

The `nargs` seems pointless.

This issue is mosly opened to have a record number to open a commit but it 
raises a few questions:

 - would it make sense to try to use GCC/CLang's logic around __attribute__ to 
have this kind of things checked during compilation as much as possible ?

 - would it make sense to define very small functions wrapping some calls to 
`PyErr_Format` so that one can use function with a very clear signature at 
(almost) no cost? This would be specially relevant for error raised in multiple 
places with the same message (The trio PyMethodDef 
*method/PyExc_TypeError/"%.200s() takes no keyword arguments" is a good 
candidate for this). I'd be happy for work on this but I'm afraid this would 
correspond to something Raymond Hettinger asks new comers not to do : "Don't be 
a picture straightener" ( 
https://speakerdeck.com/pybay2016/raymond-hettinger-keynote-core-developer-world
 ).

I've filled the impacted version as 3.7 as there is no real impacted version 
from a user point of view.

--
components: Argument Clinic
messages: 290645
nosy: SylvainDe, larry
priority: normal
severity: normal
status: open
title: Useless argument in call to PyErr_Format
type: enhancement
versions: Python 3.7

___
Python tracker 

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