[ https://issues.apache.org/jira/browse/PROTON-2868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17921558#comment-17921558 ]
ASF subversion and git services commented on PROTON-2868: --------------------------------------------------------- Commit e366bcde8c5347dbfd089b8d5a10a71ed7775c74 in qpid-proton's branch refs/heads/main from Andrew Stitcher [ https://gitbox.apache.org/repos/asf?p=qpid-proton.git;h=e366bcde8 ] PROTON-2868: [Python] Simplify C object wrapping code - Cleanup the Wrapper code so that it uses more current less magical idiomatic python to wrap the C python objects that need to be passed via the Proton event queue. - Use __new__ rather than __init__ because we are dealing with creating the objects rather than just initialising their values - Use slots because the actual python objects only have 2 fixed attributes. - Instead of passing constructor and get_context functions to the wrapper these are now declarative class variables defined in the wrapped classes. - The wrapped classes can now use __init__ more normally: They do still have to check whether they are already initialised, and not initialise again if they are, because they could be wrapping a stored away object that has already been initialised and used rather than a new wrapping. - We now provide a general wrap classmethod that can bew used for most of the wrapped types and avoid duplicating the code. - Needed to add a custom __new__ to Transport because its constructor parameters aren't compatible with the Wrapper class. - Transport still needs its custom wrap method for the same reason. - The SASL class is no longer a wrapped class (and actually never needed to be one). > Improve and simplify the scheme for wrapping C Proton objects in Python > ----------------------------------------------------------------------- > > Key: PROTON-2868 > URL: https://issues.apache.org/jira/browse/PROTON-2868 > Project: Qpid Proton > Issue Type: Improvement > Components: python-binding > Reporter: Andrew Stitcher > Assignee: Andrew Stitcher > Priority: Major > > The code used to wrap C Proton objects in Python objects when the objects > need to passed via the proton event queue is difficult ot understand and uses > unidiomatic python. > It can be rewritten for better maintainability and comprehensibility. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org