Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure on Python 3.11 #4

Open
fabaff opened this issue Jan 26, 2023 · 0 comments · May be fixed by #2
Open

Test failure on Python 3.11 #4

fabaff opened this issue Jan 26, 2023 · 0 comments · May be fixed by #2

Comments

@fabaff
Copy link

fabaff commented Jan 26, 2023

With Python 3.11 there is a test failure. A fix would probably need to go on top of #2.

============================= test session starts ==============================
platform linux -- Python 3.11.1, pytest-7.2.0, pluggy-1.0.0
rootdir: /build/pypytools-0.6.2
collected 101 items                                                            

pypytools/gc/testing/test_custom.py .....s.                              [  6%]
pypytools/gc/testing/test_fakegc.py ...                                  [  9%]
pypytools/gc/testing/test_multihook.py ........                          [ 17%]
pypytools/gc/testing/test_uniform.py ..........                          [ 27%]
pypytools/pypylog/testing/test_model.py .....                            [ 32%]
pypytools/pypylog/testing/test_parse.py .x....x                          [ 39%]
pypytools/testing/test_cast.py .                                         [ 40%]
pypytools/testing/test_codegen.py ......................                 [ 62%]
pypytools/testing/test_fakecython.py ..                                  [ 64%]
pypytools/testing/test_micronumpy.py ...........................         [ 91%]
pypytools/testing/test_unroll.py ........                                [ 99%]
pypytools/testing/test_util.py F                                         [100%]

=================================== FAILURES ===================================
________________________________ test_clonefunc ________________________________

    def test_clonefunc():
        def foo(a, b):
            return a+b
    
>       foo2 = clonefunc(foo)

pypytools/testing/test_util.py:7: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

f = <function test_clonefunc.<locals>.foo at 0x7fff8df12480>

    def clonefunc(f):
        """Deep clone the given function to create a new one.
    
        By default, the PyPy JIT specializes the assembler based on f.__code__:
        clonefunc makes sure that you will get a new function with a **different**
        __code__, so that PyPy will produce independent assembler. This is useful
        e.g. for benchmarks and microbenchmarks, so you can make sure to compare
        apples to apples.
    
        Use it with caution: if abused, this might easily produce an explosion of
        produced assembler.
        """
        # first of all, we clone the code object
        co = f.__code__
        args = [co.co_argcount, co.co_nlocals, co.co_stacksize, co.co_flags, co.co_code,
                co.co_consts, co.co_names, co.co_varnames, co.co_filename, co.co_name,
                co.co_firstlineno, co.co_lnotab, co.co_freevars, co.co_cellvars]
        if PY3:
            args.insert(1, co.co_kwonlyargcount)
        if PY3 and PY3M >= 8:
            args.insert(1, co.co_posonlyargcount)
>       co2 = types.CodeType(*args)
E       TypeError: code() argument 13 must be str, not int

pypytools/util.py:28: TypeError
=========================== short test summary info ============================
FAILED pypytools/testing/test_util.py::test_clonefunc - TypeError: code() argument 13 must be str, not int
============== 1 failed, 97 passed, 1 skipped, 2 xfailed in 0.75s ==============
@sertonix sertonix linked a pull request Jul 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant