This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients lemburg
Date 2014-06-10.16:59:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Here's the code:

    def replace_paths_in_code(self, co):
        return types.CodeType(co.co_argcount, co.co_nlocals, co.co_stacksize,
                         co.co_flags, co.co_code, tuple(consts), co.co_names,
                         co.co_varnames, new_filename, co.co_name,
                         co.co_firstlineno, co.co_lnotab,
                         co.co_freevars, co.co_cellvars)

Compare this to the code_new() C API doc string (and code):

code(argcount, kwonlyargcount, nlocals, stacksize, flags, codestring,\n\
      constants, names, varnames, filename, name, firstlineno,\n\
      lnotab[, freevars[, cellvars]])

The kwonlyargcount is missing in the call used in .replace_paths_in_code().

The bug surfaces when trying to use the "-r" option of the tool:

Traceback (most recent call last):
  File "", line 504, in <module>
  File "", line 357, in main
  File "/home/lemburg/egenix/projects/PyRun/tmp-3.4-ucs2/lib/python3.4/", line 123, in import_hook
    q, tail = self.find_head_package(parent, name)
  File "/home/lemburg/egenix/projects/PyRun/tmp-3.4-ucs2/lib/python3.4/", line 179, in find_head_package
    q = self.import_module(head, qname, parent)
  File "/home/lemburg/egenix/projects/PyRun/tmp-3.4-ucs2/lib/python3.4/", line 272, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "/home/lemburg/egenix/projects/PyRun/tmp-3.4-ucs2/lib/python3.4/", line 303, in load_module
    co = self.replace_paths_in_code(co)
  File "/home/lemburg/egenix/projects/PyRun/tmp-3.4-ucs2/lib/python3.4/", line 569, in replace_paths_in_code
    consts[i] = self.replace_paths_in_code(consts[i])
  File "/home/lemburg/egenix/projects/PyRun/tmp-3.4-ucs2/lib/python3.4/", line 575, in replace_paths_in_code
    co.co_freevars, co.co_cellvars)
TypeError: an integer is required (got type bytes)
Date User Action Args
2014-06-10 16:59:48lemburgsetrecipients: + lemburg
2014-06-10 16:59:48lemburgsetmessageid: <>
2014-06-10 16:59:48lemburglinkissue21707 messages
2014-06-10 16:59:48lemburgcreate