ADBDEV-9459: Use use gpsubprocess instead of subprocess#2259
Merged
KnightMurloc merged 5 commits intoadb-6.xfrom Mar 20, 2026
Merged
ADBDEV-9459: Use use gpsubprocess instead of subprocess#2259KnightMurloc merged 5 commits intoadb-6.xfrom
KnightMurloc merged 5 commits intoadb-6.xfrom
Conversation
Decoding the results of the subcommands has negative consequences in the Python 2 environment. In the Python 2, decode returns a unicode string whereas previously it returned a regular string. This leads to unexpected errors when trying to convert a unicode string to a byte string if it contains non-ascii characters. This patch changes the approach. Instead of decoding the results of the subcommands, the Python 3 environment now uses text mode to work with subprocesses and files. In most uses of subprocess.Popen has been replaced with the already existing wrapper gpsubprocess.Popen. A number of improvements have been made to this end. It now use a text mode in the Python 3 environment. There is a new wrapper for check_output that also uses text mode for Python 3. The gpoperation mechanism has been reworked. Instead of sending raw pickled serialized data, this data is now sent in base64 format. This was done so that the data could be sent in text mode. In gpssh, the decoding of the result is only for Python 3. In Python 2, outputting unicode strings via print can lead to an error.
Stolb27
reviewed
Mar 19, 2026
Stolb27
reviewed
Mar 19, 2026
Stolb27
reviewed
Mar 19, 2026
Stolb27
reviewed
Mar 19, 2026
Stolb27
approved these changes
Mar 20, 2026
dkovalev1
approved these changes
Mar 20, 2026
hilltracer
approved these changes
Mar 20, 2026
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.
Decoding the results of the subcommands has negative consequences in the
Python 2 environment. In the Python 2, decode returns a unicode string whereas
previously it returned a regular string. This leads to unexpected errors when
trying to convert a unicode string to a byte string if it contains non-ascii
characters. This patch changes the approach. Instead of decoding the results of
the subcommands, the Python 3 environment now uses text mode to work with
subprocesses and files. In most uses of subprocess.Popen has been replaced with
the already existing wrapper gpsubprocess.Popen. A number of improvements have
been made to this end.
It now use a text mode in the Python 3 environment. There is a new wrapper for
check_output that also uses text mode for Python 3.
Remove the futurize changes from the pexpect module since this module already
supports Python 3. In the gpssh module, decode the result only for Python 3 to
avoid the error of converting unicode to ascii when printing.
The gpoperation mechanism has been reworked. Instead of sending raw pickled
serialized data, this data is now sent in base64 format. This was done so that
the data could be sent in text mode.
In gpssh, the decoding of the result is only for Python 3. In Python 2,
outputting unicode strings via print can lead to an error.