SylvainDe / DidYouMean-Python

Module to have suggestions in case of errors (NameError, AttributeError, etc).
MIT License
122 stars 15 forks source link

Continous Integration on 3.14.0a1: Regexp does not match UNSUPPORTEDOPERANDSUGG (but matches UNSUPPORTEDOPERAND) #67

Open SylvainDe opened 3 weeks ago

SylvainDe commented 3 weeks ago

Build: https://github.com/SylvainDe/DidYouMean-Python/actions/runs/11652701227 Jobs: https://github.com/SylvainDe/DidYouMean-Python/actions/runs/11652701227/job/32444230093

Python 3.14.0a1 (main, Oct 16 2024, 03:58:15) [GCC 9.4.0]
sys.version_info(major=3, minor=14, micro=0, releaselevel='alpha', serial=1)
('CPython', '', '')
pip 24.3.1 from /opt/hostedtoolcache/Python/3.14.0-alpha.1/x64/lib/python3.14/site-packages/pip (python 3.14)
======================================================================
FAIL: test_old_print_chevron_syntax (didyoumean_sugg_tests.TypeErrorTests.test_old_print_chevron_syntax)
Trying old print chevron syntax (before Python 3).
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/DidYouMean-Python/DidYouMean-Python/didyoumean/didyoumean_sugg_tests.py", line 1918, in test_old_print_chevron_syntax
    self.throws(code, UNSUPPORTEDOPERANDSUGG, [], after)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/DidYouMean-Python/DidYouMean-Python/didyoumean/didyoumean_sugg_tests.py", line 464, in throws
    self.assertRegexp(msg, error_msg, details)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/DidYouMean-Python/DidYouMean-Python/didyoumean/didyoumean_sugg_tests.py", line 485, in assertRegexp
    return getattr(self, name)(text, regex, msg)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
AssertionError: Regex didn't match: '^unsupported operand type\\(s\\) for (?P<op>.*): \'(?P<t1>[\\w\\.-]+)\' and \'(?P<t2>[\\w\\.-]+)\'\\. Did you mean \\"(?P<sugg>.*)\\"\\?$' not found in "unsupported operand type(s) for >>: 'builtin_function_or_method' and '_io.TextIOWrapper'" : Running following code :
---
with open('/dev/null', 'w') as f:
    print >> f, 5
---

----------------------------------------------------------------------
Ran 372 tests in 1.120s

FAILED (failures=1)

It looks like the suggestion is not provided on 3.14.0a1 but is provided on the previous version:

Python 3.14.0a0 (main, Aug 29 2024, 14:17:47) [GCC 9.4.0]
sys.version_info(major=3, minor=14, micro=0, releaselevel='alpha', serial=0)
('CPython', '', '')
pip 24.3.1 from /opt/hostedtoolcache/Python/3.14.0-alpha.0/x64/lib/python3.14/site-packages/pip (python 3.14)
SylvainDe commented 3 weeks ago

I'll try to run git bisect between the versions of CPython to find the culprit and whether this was expected or not...

SylvainDe commented 3 weeks ago

$ cat Lib/test/test_sdesodt/test_67.py

# make && make test TESTOPTS="-v test_sdesodt.test_67"

import unittest

class OldPrintChevronSyntaxTest(unittest.TestCase):

    def test_toto(self):
        with self.assertRaisesRegex(TypeError, 'Did you mean'):
            with open('/dev/null', 'w') as f:
                print >> f, 5
SylvainDe commented 3 weeks ago
$ git bisect log
git bisect start
# bad: [3d4fda2165e7c97116e69d6efef187873b57d01f] gh-119793: Prefer `map(..., strict=True)` over starmap/zip in examples (#126407)
git bisect bad 3d4fda2165e7c97116e69d6efef187873b57d01f
# good: [2d7ff6e0e7d4c08ba84079a5c19a4a485626e1de] Restore decimal context after decimal doctests (GH-120149)
git bisect good 2d7ff6e0e7d4c08ba84079a5c19a4a485626e1de
# bad: [460ee5b994335994d4b5186c08f44e775b3e55fa] gH-80788: remove old weakset workaround for thread safety (#123388)
git bisect bad 460ee5b994335994d4b5186c08f44e775b3e55fa
# good: [6b98b274b60a15b490d2ea85069638c037b2a9cd] gh-76785: Expand How Interpreter Queues Handle Interpreter Finalization (gh-116431)
git bisect good 6b98b274b60a15b490d2ea85069638c037b2a9cd
# good: [4b63cd170e5dd840bffc80922f09f2d69932ff5c] gh-122527: Fix a crash on deallocation of `PyStructSequence` (GH-122577)
git bisect good 4b63cd170e5dd840bffc80922f09f2d69932ff5c
# bad: [05fc4d758aa9b731c722e6c1c18e1f5e54597393] gh-122985: add SYMBOL_TO_SCOPE macro in symtable (#122986)
git bisect bad 05fc4d758aa9b731c722e6c1c18e1f5e54597393
# good: [540fcc62f5da982b79504221cac01bfab8b73ba1] gh-118814: Fix the TypeVar constructor when name is passed by keyword (GH-122664)
git bisect good 540fcc62f5da982b79504221cac01bfab8b73ba1
# good: [ea70439bd2b5a1c881342646f30942f527f61373] gh-122701: Fix wording of raw strings/bytes in `lexical_analysis.rst` (#122702)
git bisect good ea70439bd2b5a1c881342646f30942f527f61373
# bad: [ab094d1b2b348f670743f88e52d1a3f2cab5abd5] gh-117139: Replace _PyList_FromArraySteal with stack ref variant (#122830)
git bisect bad ab094d1b2b348f670743f88e52d1a3f2cab5abd5
# bad: [253c6a0b2f88b3327b7113860b99d665346fe43c] Fix typos in comments and test code (#122846)
git bisect bad 253c6a0b2f88b3327b7113860b99d665346fe43c
# good: [4534068f22f07a8ab9871bc16abf03c478ee2532] gh-119180: annotationlib: Fix __all__, formatting (#122365)
git bisect good 4534068f22f07a8ab9871bc16abf03c478ee2532
# good: [6aa35f3002dda25858d47e702e750e2871e42a7c] gh-122903: Honor directories in zipfile.Path.glob. (#122908)
git bisect good 6aa35f3002dda25858d47e702e750e2871e42a7c
[9375b9ca3a4998678ba74ff5c77ed540a4dcf887] Remove "print >>obj" exception hint for Python 2 (#122853)

https://github.com/python/cpython/pull/122853