Bug 2359530 - python-beancount fails to build with Python 3.14: TestReferenceCounting and TestLexer fail with AssertionError
Summary: python-beancount fails to build with Python 3.14: TestReferenceCounting and T...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-beancount
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Davide Cavalca
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2025-04-14 15:12 UTC by Karolina Surma
Modified: 2025-04-14 15:12 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2025-04-14 15:12:47 UTC
python-beancount fails to build with Python 3.14.0a7.

___________________________ TestLexer.test_bad_date ____________________________

self = <beancount.parser.lexer_test.TestLexer testMethod=test_bad_date>
tokens = [('error', 1, b'2013-12-98', None), ('EOL', 2, b'\n', None)]
errors = [LexerError(source={'filename': '', 'lineno': 1}, message='ValueError: day 98 must be in range 1..31 for month 12 in year 2013', entry=None)]

    @lex_tokens
    def test_bad_date(self, tokens, errors):
        """\
          2013-12-98
        """
        self.assertEqual(
            [
                ("error", 1, b"2013-12-98", None),
                ("EOL", 2, b"\n", None),
            ],
            tokens,
        )
        self.assertTrue(errors)
>       self.assertRegex(errors[0].message, "out of range|month must be|day must be in")
E       AssertionError: Regex didn't match: 'out of range|month must be|day must be in' not found in 'ValueError: day 98 must be in range 1..31 for month 12 in year 2013'

beancount/parser/lexer_test.py:275: AssertionError
____________________ TestReferenceCounting.test_parser_lex _____________________

self = <beancount.parser.parser_test.TestReferenceCounting testMethod=test_parser_lex>

    def test_parser_lex(self):
        # Do not use a string to avoid issues due to string interning.
        name = object()
        # Note that passing name as an argument to sys.getrefcount()
        # counts as one reference, thus the minimum reference count
        # returned for any object is 2.
>       self.assertEqual(sys.getrefcount(name), 2)
E       AssertionError: 1 != 2

beancount/parser/parser_test.py:192: AssertionError
________________ TestReferenceCounting.test_parser_lex_filename ________________

self = <beancount.parser.parser_test.TestReferenceCounting testMethod=test_parser_lex_filename>

    def test_parser_lex_filename(self):
        # Do not use a string to avoid issues due to string interning.
        name = object()
>       self.assertEqual(sys.getrefcount(name), 2)
E       AssertionError: 1 != 2

beancount/parser/parser_test.py:233: AssertionError
_________________ TestReferenceCounting.test_parser_lex_multi __________________

self = <beancount.parser.parser_test.TestReferenceCounting testMethod=test_parser_lex_multi>

    def test_parser_lex_multi(self):
        file1 = io.BytesIO(b"")
        file1.name = object()
        self.assertEqual(sys.getrefcount(file1.name), 2)
    
        file2 = io.BytesIO(b"")
        file2.name = object()
        self.assertEqual(sys.getrefcount(file2.name), 2)
    
        builder = lexer.LexBuilder()
        parser = _parser.Parser(builder)
        _tokens = list(parser.lex(file1))
        _tokens = list(parser.lex(file2))
    
        del parser
        # Once the Parser object is gone we should have just the local
        # references to the file objects and one references to the names.
>       self.assertEqual(sys.getrefcount(file1), 2)
E       AssertionError: 1 != 2

beancount/parser/parser_test.py:274: AssertionError
___________________ TestReferenceCounting.test_parser_parse ____________________

self = <beancount.parser.parser_test.TestReferenceCounting testMethod=test_parser_parse>

    def test_parser_parse(self):
        # Do not use a string to avoid issues due to string interning.
        name = object()
>       self.assertEqual(sys.getrefcount(name), 2)
E       AssertionError: 1 != 2

beancount/parser/parser_test.py:282: AssertionError
=========================== short test summary info ============================
FAILED beancount/parser/lexer_test.py::TestLexer::test_bad_date - AssertionEr...
FAILED beancount/parser/parser_test.py::TestReferenceCounting::test_parser_lex
FAILED beancount/parser/parser_test.py::TestReferenceCounting::test_parser_lex_filename
FAILED beancount/parser/parser_test.py::TestReferenceCounting::test_parser_lex_multi
FAILED beancount/parser/parser_test.py::TestReferenceCounting::test_parser_parse

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08899226-python-beancount/

For all our attempts to build python-beancount with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-beancount/

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.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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.


Note You need to log in before you can comment on or make changes to this bug.