This is an automated email from the ASF dual-hosted git repository.

Cole-Greer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/master by this push:
     new 4946e1600f Fix gremlin-python GremlinLang equality and submitAsync 
bugs (#3520)
4946e1600f is described below

commit 4946e1600fdf31066d335f047293059d652bacf7
Author: Guian Gumpac <[email protected]>
AuthorDate: Sat Jul 18 18:13:38 2026 -0700

    Fix gremlin-python GremlinLang equality and submitAsync bugs (#3520)
    
    Two bugs introduced in `4.0.0-beta.1` during the Bytecode-to-GremlinLang
    migration.
    
    1. `GremlinLang.__eq__` ignores the query
    
    `__eq__` compared `self.gremlin` to itself instead of to `other.gremlin`, so
    equality depended only on the parameters and ignored the actual steps.
    
    2. `DriverRemoteConnection.submitAsync` is broken
    
    The deprecated `submitAsync` alias forwarded three positional arguments to
    `submit_async`, which had been narrowed to a single `gremlin_lang` argument 
in
    4.x, and it never returned the future - so it could not work at all. Rather 
than
    repair a deprecated method, it has been removed, with an upgrade
    note directing users to `submit_async()`.
    
    Assisted-by: Kiro: Claude Opus 4.8
---
 CHANGELOG.asciidoc                                 |  2 ++
 docs/src/upgrade/release-4.x.x.asciidoc            | 14 ++++++++++
 .../driver/driver_remote_connection.py             |  8 ------
 .../python/gremlin_python/process/traversal.py     |  2 +-
 .../python/tests/unit/process/test_gremlin_lang.py | 30 ++++++++++++++++++++++
 5 files changed, 47 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index d0fb4b07b9..e17a9c506e 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,8 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-4-0-0]]
 === TinkerPop 4.0.0 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Fixed `gremlin-python` `GremlinLang` equality (`__eq__`) which compared a 
traversal to itself, so traversals with different steps but equal parameters 
were incorrectly considered equal.
+* Removed the deprecated `gremlin-python` `DriverRemoteConnection.submitAsync` 
method in favor of `submit_async`.
 * Added GraphBinary `Tree` (`0x2b`) serialization and deserialization with a 
native tree-shaped API to `gremlin-python`, `gremlin-dotnet`, `gremlin-go`, and 
`gremlin-javascript`.
 * Added a `gremlin/io` package export in `gremlin-javascript` exposing the 
GraphBinary type serializers.
 * Raised the minimum Java version to 17 for building and running *(breaking)*.
diff --git a/docs/src/upgrade/release-4.x.x.asciidoc 
b/docs/src/upgrade/release-4.x.x.asciidoc
index 129e66ec2b..dfae95e806 100644
--- a/docs/src/upgrade/release-4.x.x.asciidoc
+++ b/docs/src/upgrade/release-4.x.x.asciidoc
@@ -618,6 +618,20 @@ from gremlin_python.driver.connection import 
GremlinServerError
 
 See: 
link:https://tinkerpop.apache.org/docs/4.0.0-beta.3/reference/#gremlin-python[Gremlin-Python]
 
+==== Removal of Python DriverRemoteConnection.submitAsync
+
+The deprecated `DriverRemoteConnection.submitAsync()` method has been removed. 
After the TinkerPop 4 change to accept
+a single `GremlinLang` argument, it no longer functioned. Use `submit_async()` 
instead:
+
+[source,python]
+----
+# Before
+future = connection.submitAsync(gremlin_lang)
+
+# After
+future = connection.submit_async(gremlin_lang)
+----
+
 ==== Removal of sparql-gremlin
 
 The `sparql-gremlin` module has been removed following a prolonged period of 
inactivity. There is currently no direct
diff --git 
a/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
 
b/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
index be0d92ed5b..4d1e147fcc 100644
--- 
a/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
+++ 
b/gremlin-python/src/main/python/gremlin_python/driver/driver_remote_connection.py
@@ -18,7 +18,6 @@
 #
 import logging
 from concurrent.futures import Future
-import warnings
 
 from gremlin_python.driver import client, serializer
 from gremlin_python.driver.remote_connection import RemoteConnection, 
RemoteTraversal
@@ -74,13 +73,6 @@ class DriverRemoteConnection(RemoteConnection):
                                          
request_options=self.extract_request_options(gremlin_lang))
         return RemoteTraversal(result_set)
 
-    def submitAsync(self, message, parameters=None, request_options=None):
-        warnings.warn(
-            
"gremlin_python.driver.driver_remote_connection.DriverRemoteConnection.submitAsync
 will be replaced by "
-            
"gremlin_python.driver.driver_remote_connection.DriverRemoteConnection.submit_async.",
-            DeprecationWarning)
-        self.submit_async(message, parameters, request_options)
-
     def submit_async(self, gremlin_lang):
         log.debug("submit_async with gremlin lang script '%s'", 
gremlin_lang.get_gremlin())
         future = Future()
diff --git a/gremlin-python/src/main/python/gremlin_python/process/traversal.py 
b/gremlin-python/src/main/python/gremlin_python/process/traversal.py
index 5adc335d33..943dc859e5 100644
--- a/gremlin-python/src/main/python/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/python/gremlin_python/process/traversal.py
@@ -1135,7 +1135,7 @@ class GremlinLang(object):
 
     def __eq__(self, other):
         if isinstance(other, self.__class__):
-            return ''.join(self.gremlin) == ''.join(self.gremlin) and 
self.parameters == other.parameters
+            return ''.join(self.gremlin) == ''.join(other.gremlin) and 
self.parameters == other.parameters
         else:
             return False
 
diff --git 
a/gremlin-python/src/main/python/tests/unit/process/test_gremlin_lang.py 
b/gremlin-python/src/main/python/tests/unit/process/test_gremlin_lang.py
index 43ce4da980..4d6f6f76eb 100644
--- a/gremlin-python/src/main/python/tests/unit/process/test_gremlin_lang.py
+++ b/gremlin-python/src/main/python/tests/unit/process/test_gremlin_lang.py
@@ -708,3 +708,33 @@ class TestGremlinLang(object):
         assert ("g.match('" + query + "')") == 
g.match(query).gremlin_lang.get_gremlin()
         params = {'name': 'marko'}
         assert ("g.match('" + query + "',['name':'marko'])") == g.match(query, 
params).gremlin_lang.get_gremlin()
+
+    def test_eq_different_gremlin_steps_not_equal(self):
+        # Same (empty) parameters but different gremlin steps must not compare 
equal.
+        g = traversal().with_(None)
+        count = g.V().count().gremlin_lang
+        drop = g.V().drop().gremlin_lang
+        assert count.parameters == drop.parameters
+        assert count.get_gremlin() != drop.get_gremlin()
+        assert count != drop
+        assert drop != count
+
+    def test_eq_equivalent_are_equal(self):
+        g = traversal().with_(None)
+        first = g.V().count().gremlin_lang
+        second = g.V().count().gremlin_lang
+        assert first == second
+
+    def test_eq_equal_gremlin_different_parameters_not_equal(self):
+        g = traversal().with_(None)
+        first = g.V(GValue('ids', 1)).gremlin_lang
+        second = g.V(GValue('ids', 2)).gremlin_lang
+        assert first.get_gremlin() == second.get_gremlin()
+        assert first != second
+
+    def test_eq_non_gremlinlang_not_equal(self):
+        g = traversal().with_(None)
+        gl = g.V().count().gremlin_lang
+        assert gl != 'g.V().count()'
+        assert gl != 42
+        assert gl != None

Reply via email to