Bug 2280964

Summary: pythran fails to build with Python 3.13: TestDoctest.test_tutorial, TestDoctest.test_utils, TestNumpyUFuncUnary.test_numpy_ufunc_unary_numpy_ufunc_unary_numpy_signbit_scalar_float fail
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: pythranAssignee: Miro Hrončok <mhroncok>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fti-bugs, ksurma, mhroncok, python-packagers-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pythran-0.16.1-3.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-16 07:17:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2279988, 2291636    
Bug Blocks: 2260875, 2260877, 2244836, 2291911    

Description Karolina Surma 2024-05-17 11:42:44 UTC
pythran fails to build with Python 3.13.0b1.

_ TestNumpyUFuncUnary.test_numpy_ufunc_unary_numpy_ufunc_unary_numpy_signbit_scalar_float _
[gw0] linux -- Python 3.13.0 /usr/bin/python3

self = <pythran.tests.test_numpy_ufunc_unary.TestNumpyUFuncUnary testMethod=test_numpy_ufunc_unary_numpy_ufunc_unary_numpy_signbit_scalar_float>

>   import sys;exec(eval(sys.stdin.readline()))

<string>:1: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pythran/tests/__init__.py:327: in run_test
    self.assertAlmostEqual(python_ref, pythran_res)
pythran/tests/__init__.py:117: in assertAlmostEqual
    self.check_type(ref, res)
pythran/tests/__init__.py:101: in check_type
    self.assertIsInstance(res, (bool, bool_))
E   AssertionError: 0.0 is not an instance of (<class 'bool'>, <class 'numpy.bool_'>)
----------------------------- Captured stdout call -----------------------------
Python result:  False
Pythran result:  0.0
Type of Pythran res :  <class 'float'>
Type of Python ref :  <class 'numpy.bool_'>
----------------------------- Captured stderr call -----------------------------
INFO: Generated module: test_numpy_ufunc_unary_numpy_signbit_scalar_float
INFO: Output: /builddir/build/BUILD/pythran-0.14.0/test_numpy_ufunc_unary_numpy_signbit_scalar_float.cpython-313-x86_64-linux-gnu.so
__________________________ TestDoctest.test_tutorial ___________________________
[gw0] linux -- Python 3.13.0 /usr/bin/python3

self = <pythran.tests.test_xdoc.TestDoctest testMethod=test_tutorial>

    @pytest.mark.skipif(sys.platform == "win32",
                        reason="We should create a file for windows.")
    def test_tutorial(self):
        failed, _ = doctest.testfile('../../docs/TUTORIAL.rst')
>       self.assertEqual(failed, 0)
E       AssertionError: 4 != 0

pythran/tests/test_xdoc.py:25: AssertionError
----------------------------- Captured stdout call -----------------------------
**********************************************************************
File "/builddir/build/BUILD/pythran-0.14.0/pythran/tests/../../docs/TUTORIAL.rst", line 22, in TUTORIAL.rst
Failed example:
    print(ast.dump(tree))  # view it as a string
Expected:
    Module(body=[Assign(targets=[Name(id='a', ctx=Store(), annotation=None, type_comment=None)], value=Constant(value=1, kind=None), type_comment=None)], type_ignores=[])
Got:
    Module(body=[Assign(targets=[Name(id='a', ctx=Store())], value=Constant(value=1))])
**********************************************************************
File "/builddir/build/BUILD/pythran-0.14.0/pythran/tests/../../docs/TUTORIAL.rst", line 35, in TUTORIAL.rst
Failed example:
    print(ast.dump(tree))
Expected:
    Module(body=[FunctionDef(name='fib', args=arguments(args=[Name(id='n', ctx=Param(), annotation=None, type_comment=None)], posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]), body=[Return(value=IfExp(test=Compare(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), ops=[Lt()], comparators=[Constant(value=2, kind=None)]), body=Name(id='n', ctx=Load(), annotation=None, type_comment=None), orelse=BinOp(left=Call(func=Name(id='fib', ctx=Load(), annotation=None, type_comment=None), args=[BinOp(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), op=Sub(), right=Constant(value=1, kind=None))], keywords=[]), op=Add(), right=Call(func=Name(id='fib', ctx=Load(), annotation=None, type_comment=None), args=[BinOp(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), op=Sub(), right=Constant(value=2, kind=None))], keywords=[]))))], decorator_list=[], returns=None, type_comment=None)], type_ignores=[])
Got:
    Module(body=[FunctionDef(name='fib', args=arguments(args=[Name(id='n', ctx=Param())]), body=[Return(value=IfExp(test=Compare(left=Name(id='n', ctx=Load()), ops=[Lt()], comparators=[Constant(value=2)]), body=Name(id='n', ctx=Load()), orelse=BinOp(left=Call(func=Name(id='fib', ctx=Load()), args=[BinOp(left=Name(id='n', ctx=Load()), op=Sub(), right=Constant(value=1))]), op=Add(), right=Call(func=Name(id='fib', ctx=Load()), args=[BinOp(left=Name(id='n', ctx=Load()), op=Sub(), right=Constant(value=2))]))))])])
**********************************************************************
File "/builddir/build/BUILD/pythran-0.14.0/pythran/tests/../../docs/TUTORIAL.rst", line 201, in TUTORIAL.rst
Failed example:
    sorted(map(ast.dump, ce))
Expected:
    ["Attribute(value=Name(id='math', ctx=Load(), annotation=None, type_comment=None), attr='cos', ctx=Load())", 'Constant(value=3, kind=None)']
Got:
    ["Attribute(value=Name(id='math', ctx=Load()), attr='cos', ctx=Load())", 'Constant(value=3)']
**********************************************************************
File "/builddir/build/BUILD/pythran-0.14.0/pythran/tests/../../docs/TUTORIAL.rst", line 212, in TUTORIAL.rst
Failed example:
    print(ast.dump(returned))
Expected:
    Name(id='b', ctx=Load(), annotation=None, type_comment=None)
Got:
    Name(id='b', ctx=Load())
**********************************************************************
1 item had failures:
   4 of  79 in TUTORIAL.rst
***Test Failed*** 4 failures.
____________________________ TestDoctest.test_utils ____________________________
[gw0] linux -- Python 3.13.0 /usr/bin/python3

self = <pythran.tests.test_xdoc.TestDoctest testMethod=test_utils>

>   lambda self: generic_test_package(self, module))

pythran/tests/test_xdoc.py:89: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pythran/tests/test_xdoc.py:83: in generic_test_package
    self.assertEqual(failed, 0)
E   AssertionError: 1 != 0
----------------------------- Captured stdout call -----------------------------
**********************************************************************
File "/builddir/build/BUILD/pythran-0.14.0/pythran/utils.py", line 108, in pythran.utils.get_variable
Failed example:
    ast.dump(get_variable(ref))
Expected:
    "Name(id='a', ctx=Load(), annotation=None, type_comment=None)"
Got:
    "Name(id='a', ctx=Load())"
**********************************************************************
1 item had failures:
   1 of   3 in pythran.utils.get_variable
***Test Failed*** 1 failure.


https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/07449638-pythran/

For all our attempts to build pythran with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/pythran/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Karolina Surma 2024-06-12 15:11:01 UTC
*** Bug 2291991 has been marked as a duplicate of this bug. ***

Comment 2 Miro Hrončok 2024-06-15 21:07:01 UTC
Reported upstream: https://github.com/serge-sans-paille/pythran/issues/2214

I think we can skip the 2 tests and link to the report.