ivankelly commented on a change in pull request #3067: PIP-25: C++ / Python / 
Go implementation for token authentication
URL: https://github.com/apache/pulsar/pull/3067#discussion_r236614582
 
 

 ##########
 File path: pulsar-client-cpp/python/src/authentication.cc
 ##########
 @@ -32,6 +32,59 @@ struct AuthenticationTlsWrapper : public 
AuthenticationWrapper {
     }
 };
 
+struct TokenSupplierWrapper {
+    PyObject* _pySupplier;
+
+    TokenSupplierWrapper(py::object pySupplier) :
+        _pySupplier(pySupplier.ptr()) {
+        Py_XINCREF(_pySupplier);
+    }
+
+    TokenSupplierWrapper(const TokenSupplierWrapper& other) {
+        _pySupplier= other._pySupplier;
+        Py_XINCREF(_pySupplier);
+    }
+
+    TokenSupplierWrapper& operator=(const TokenSupplierWrapper& other) {
+        _pySupplier = other._pySupplier;
+        Py_XINCREF(_pySupplier);
+        return *this;
+    }
+
+    virtual ~TokenSupplierWrapper() {
+        Py_XDECREF(_pySupplier);
+    }
+
+    std::string operator()() {
+        PyGILState_STATE state = PyGILState_Ensure();
 
 Review comment:
   why do you need to acquire the GIL? _pySupplier is immutable.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to