Closed Bug 1799982 Opened 2 years ago Closed 2 years ago

xpidl.py has errors with Python 3.11

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox-esr102 --- fixed
firefox108 --- fixed

People

(Reporter: alaskanemily, Assigned: mccr8)

References

Details

Attachments

(1 file)

Trying to compile with Python 3.11, we seem to run afoul of https://github.com/python/cpython/issues/91222

I had a quick look but I don't know enough about Python regexs to really diagnose this any better.

 0:01.33 ERROR: /home/emily/dev/gecko-dev/xpcom/idl-parser/xpidl/xpidl.py:1641: Invalid regular expression for rule 't_multilinecomment'. global flags not at the start of the expression at position 26
 0:01.33 ERROR: /home/emily/dev/gecko-dev/xpcom/idl-parser/xpidl/xpidl.py:1647: Invalid regular expression for rule 't_singlelinecomment'. global flags not at the start of the expression at position 24
 0:01.33 ERROR: /home/emily/dev/gecko-dev/xpcom/idl-parser/xpidl/xpidl.py:1660: Invalid regular expression for rule 't_LCDATA'. global flags not at the start of the expression at position 13

Thanks for filing. The regexp for multi line comments is r"/\*(?s).*?\*/". It looks like the IPDL compiler also has a t_multilinecomment and it does r"/\*(\n|.)*?\*/". So. Basically, (\n|.) instead of (?s). if I'm reading this correctly?

I think we can also use the t_linecomment(t) rule from IPDL for t_singlelinecomment. At least, things build with both of those swapped...

Assignee: nobody → continuation

Looks like the LCDATA one can also be fixed by changing . to (\n|.).

Apparently the use of these is being turned into an error in Python 3.11.
Fortunately, our uses appears to be rather trivial.

For t_multilinecomment and t_LCDATA, I dropped the (?s) flag and just
replaced the one use of . with (\n|.). (?s) means DOTALL, which means
that dot includes any character, including a newline. Otherwise it means
dot includes any character except a newline.

I took the new t_singlelinecomment from IPDL's parser.py, so I assume
it is reasonable enough. t_multilinecomment is also now the same as
in IPDL.

At your convenience, could you confirm that everything works in 3.11 with this patch applied? No big hurry, because I removed flags so I don't see how it wouldn't work, but it would be nice to double check. Thanks.

Flags: needinfo?(emcdonough)
Duplicate of this bug: 1797961

Yes, this fixes it on my system! Thanks for the quick fix.

Flags: needinfo?(emcdonough)
Pushed by amccreight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/53badec13c4c Remove uses of inline flags from XPIDL regexps. r=xpcom-reviewers,kmag
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch

Comment on attachment 9302761 [details]
Bug 1799982 - Remove uses of inline flags from XPIDL regexps.

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Build failure with python 3.11
  • User impact if declined: See above
  • Fix Landed on Version: 108
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Practically speaking, this is a no-op change.
Attachment #9302761 - Flags: approval-mozilla-esr102?

Comment on attachment 9302761 [details]
Bug 1799982 - Remove uses of inline flags from XPIDL regexps.

Approved for 102.8esr.

Attachment #9302761 - Flags: approval-mozilla-esr102? → approval-mozilla-esr102+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: