[Python-Dev] How do I ensure that my code is being executed?

Neil Girdhar mistersheik at gmail.com
Tue Jan 20 15:59:27 CET 2015


Good eye!  I did the following grep:

~/cpython: grep -R takes.exac *
Doc/c-api/bytes.rst:   Identical to :c:func:`PyBytes_FromFormat` except
that it takes exactly two
Doc/c-api/unicode.rst:   Identical to :c:func:`PyUnicode_FromFormat` except
that it takes exactly two
Doc/library/unittest.mock.rst:   TypeError: <lambda>() takes exactly 3
arguments (1 given)
Doc/whatsnew/2.0.rst:The ``\x`` escape in string literals now takes exactly
2 hex digits.  Previously
Lib/test/test_compileall.py:    def test_d_takes_exactly_one_dir(self):
Lib/test/test_inspect.py:        # f1 takes exactly 2 arguments
Lib/test/test_inspect.py:            # f1/f2 takes exactly/at most 2
arguments
Lib/tkinter/__init__.py:        # TypeError: setvar() takes exactly 3
arguments (2 given)
Modules/_ctypes/_ctypes.c:                     "call takes exactly %d
arguments xxx (%zd given)",
Objects/methodobject.c:                "%.200s() takes exactly one argument
(%zd given)",
Binary file Objects/methodobject.o matches
Binary file Programs/_freeze_importlib matches
Binary file Programs/_testembed matches
Python/ceval.c:                     "%.200s() takes exactly one argument
(%d given)",
Python/ceval.c.orig:                     "%.200s() takes exactly one
argument (%d given)",
Binary file Python/ceval.o matches
Binary file libpython3.5dm.a matches
Binary file python.exe matches

I'll keep searching…

On Tue, Jan 20, 2015 at 9:52 AM, Stefan Ring <stefanrin at gmail.com> wrote:

> On Tue, Jan 20, 2015 at 3:35 PM, Neil Girdhar <mistersheik at gmail.com>
> wrote:
> > I get error:
> >
> > TypeError: init_builtin() takes exactly 1 argument (0 given)
> >
> > The only source file that can generate that error is
> > Modules/_ctypes/_ctypes.c, but when I make changes to that file such as:
> >
> >         PyErr_Format(PyExc_TypeError,
> >                      "call takes exactly %d arguments XYZABC (%zd
> given)",
> >                      inargs_index, actual_args);
> >
> > I do not see any difference after make clean and a full rebuild.  How is
> > this possible?  I need to debug the arguments passed.
>
> The message says "argument", the source code says "arguments" (I
> suppose that you only added the XYZABC), so this cannot be source of
> this exception.
>
> grep for "given" in ceval.c
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150120/aee27ce8/attachment-0001.html>


More information about the Python-Dev mailing list