Add erlang.whereis() for Python to lookup registered Erlang PIDs#39
Merged
Add erlang.whereis() for Python to lookup registered Erlang PIDs#39
Conversation
Implement whereis lookup that allows Python code to find Erlang processes
registered with erlang:register/2.
Implementation:
- Add erlang.whereis() Python function that accepts str, bytes, or Atom
- Use Erlang callback mechanism (_whereis) instead of direct enif_whereis_pid
to avoid crashes with certain OTP configurations
- Register _whereis callback in py_callback:register_callbacks/0 at startup
Usage:
pid = erlang.whereis("my_server") # Returns Pid or None
pid = erlang.whereis(erlang.atom("my_server")) # Also works with atoms
Tests:
- test_whereis_registered_process: lookup existing registered process
- test_whereis_nonexistent: lookup non-registered name returns None
- test_whereis_with_atom: lookup using erlang.Atom type
- test_whereis_with_bytes: lookup using bytes
- test_whereis_invalid_type: invalid argument raises TypeError
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
erlang.whereis()Python function to lookup registered Erlang processesUsage