jrmccluskey commented on code in PR #31170:
URL: https://github.com/apache/beam/pull/31170#discussion_r1589736261
##########
sdks/python/apache_beam/typehints/trivial_inference.py:
##########
@@ -432,6 +433,8 @@ def infer_return_type_func(f, input_types, debug=False,
depth=0):
elif op in dis.haslocal:
print('(' + co.co_varnames[arg] + ')', end=' ')
elif op in dis.hascompare:
+ if (sys.version_info.major, sys.version_info.minor) >= (3, 12):
+ arg = arg >> 4
Review Comment:
This one is funny in that it was actually an undocumented change as best as
I could tell. The comparison operations are similar to the intrinsic functions
here in that the arg for a comparison op is an integer index into a list of
operations that you index into. The output is always a boolean here anyway so
we don't necessarily care what the operation itself is, but for debugging
purposes we get the operation to print anyway. The problem was that these
indices got bit shifted (a trick this package really likes to do for operations
in different versions), so our print statement here was failing with an
out-of-range index.
I'll try to add some comments around some of these changes since they're a
little arbitrary, but for the most part it really just breaks down to "this
argument's representation was changed in the package so we have to change it
here for this version"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]