summaryrefslogtreecommitdiff
path: root/Misc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-11-03 12:18:50 +0200
committerGitHub <noreply@github.com>2022-11-03 12:18:50 +0200
commit22bbb0c4c7ba4cfddea3f4cec03f50be34479516 (patch)
tree9f89a72ce2678923aedecdafc650908782a6d36e /Misc
parentgh-98512: Add more tests for `ValuesView` (GH-98515) (diff)
downloadcpython-22bbb0c4c7ba4cfddea3f4cec03f50be34479516.tar.gz
cpython-22bbb0c4c7ba4cfddea3f4cec03f50be34479516.tar.bz2
cpython-22bbb0c4c7ba4cfddea3f4cec03f50be34479516.zip
[3.10] gh-98740: Fix validation of conditional expressions in RE (GH-98764) (GH-99046)
In very rare circumstances the JUMP opcode could be confused with the argument of the opcode in the "then" part which doesn't end with the JUMP opcode. This led to incorrect detection of the final JUMP opcode and incorrect calculation of the size of the subexpression. NOTE: Changed return value of functions _validate_inner() and _validate_charset() in Modules/_sre/sre.c. Now they return 0 on success, -1 on failure, and 1 if the last op is JUMP (which usually is a failure). Previously they returned 1 on success and 0 on failure. (cherry picked from commit e9ac890c0273aee413aa528cc202c3efa29f1d7a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2022-10-27-12-56-38.gh-issue-98740.ZoqqGM.rst3
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2022-10-27-12-56-38.gh-issue-98740.ZoqqGM.rst b/Misc/NEWS.d/next/Library/2022-10-27-12-56-38.gh-issue-98740.ZoqqGM.rst
new file mode 100644
index 00000000000..887d506d4bd
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-10-27-12-56-38.gh-issue-98740.ZoqqGM.rst
@@ -0,0 +1,3 @@
+Fix internal error in the :mod:`re` module which in very rare circumstances
+prevented compilation of a regular expression containing a :ref:`conditional
+expression <re-conditional-expression>` without the "else" branch.