kristynsmith opened a new pull request, #40711:
URL: https://github.com/apache/beam/pull/40711

   Fixes several edge cases in `code_object_pickler` when generating and 
resolving stable code object identifiers:
   - Addressed the case where multiple nested `def` functions have the same 
name (e.g. defined across `if`/`else` branches) by applying the same signature 
and bytecode-hash disambiguation in `_search_locals` (formerly 
`_search_lambda`) to any duplicate code object name in `co_consts`, and 
updating `_OBJECT_WITH_ARGS_PATTERN` and `_OBJECT_WITH_HASH_PATTERN` to match 
named functions in addition to `<lambda>`.
   - Addressed the case where one of multiple lambdas/nested functions takes no 
arguments by updating `_OBJECT_WITH_ARGS_PATTERN` to match empty argument 
tuples `()`.
   - Addressed the case where two lambdas or nested functions have identical 
`co_code` bytecode instructions (e.g. referencing different closure variables 
or constants) by including `co_consts`, `co_names`, `co_varnames`, 
`co_freevars`, and `co_cellvars` in `_create_bytecode_hash`.
   - Addressed the case where a parent package re-exports a symbol with the 
same name as a submodule (e.g. `from pkg.submod import submod` in 
`pkg/__init__.py`) by resolving the longest matching module prefix in 
`get_code_from_identifier` before traversing attributes.
   - Addressed the case where an outer and inner function share the same 
decorator wrapper by returning `None` (falling back to default pickling) 
instead of raising `ValueError('Qual name parts too long')` when a branch does 
not match the full `__qualname__`.


-- 
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]

Reply via email to