jrmccluskey commented on code in PR #31170: URL: https://github.com/apache/beam/pull/31170#discussion_r1589742323
########## sdks/python/apache_beam/typehints/opcodes.py: ########## @@ -188,6 +204,31 @@ def store_subscr(unused_state, unused_args): pass +def binary_slice(state, args): + _ = state.stack.pop() + _ = state.stack.pop() + base = Const.unwrap(state.stack.pop()) + if base is str: + out = base + elif isinstance(base, typehints.IndexableTypeConstraint): + out = base + else: + out = element_type(base) Review Comment: Hmm that's actually an implementation interpretation I hadn't thought of. The documentation for the op is here - https://docs.python.org/3/library/dis.html#opcode-BINARY_SLICE and I was adapting the BINARY_SUBSCR code (which is doing similar work with a single index arg instead of a slice.) I think most cases will be caught by the indexable type constraint (so the type of the container is what we return) but that else case might not be handling things correctly. I'll see if I can get a bit more of an understanding on this op code specifically. -- 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]
