[Git][NTPsec/ntpsec][master] 3 commits: Python3: socket.recv() returns bytes, not a string

Eric S. Raymond gitlab at mg.gitlab.com
Sun Nov 27 04:52:46 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
3aefb058 by Matt Selsky at 2016-11-26T23:04:10-05:00
Python3: socket.recv() returns bytes, not a string

- - - - -
580de21f by Matt Selsky at 2016-11-26T23:42:29-05:00
Python3: Force subprocess.Popen to return strings instead of bytes

Fixes GitLab issue #163

- - - - -
09ffc346 by Matt Selsky at 2016-11-26T23:47:01-05:00
No more need to cast to str.

- - - - -


2 changed files:

- pylib/packet.py
- wafhelpers/configure.py


Changes:

=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -924,7 +924,7 @@ class ControlSession:
 
             if self.debug:
                 warn("At %s, socket read begins\n" % time.asctime())
-            rawdata = polystr(self.sock.recv(4096))
+            rawdata = polybytes(self.sock.recv(4096))
             if self.debug:
                 warn("Received %d octets\n" % len(rawdata))
             rpkt = ControlPacket(self)


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -126,9 +126,9 @@ def cmd_configure(ctx, config):
         if exists(".git") and ctx.find_program("git", var="BIN_GIT", mandatory=False):
                 ctx.start_msg("DEVEL: Getting revision")
                 cmd = ["git", "log", "-1", "--format=%H"]
-                p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=None)
+                p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
                 ctx.env.NTPSEC_REVISION, stderr = p.communicate()
-                ctx.env.NTPSEC_REVISION = str(ctx.env.NTPSEC_REVISION).replace("\n", "")
+                ctx.env.NTPSEC_REVISION = ctx.env.NTPSEC_REVISION.replace("\n", "")
                 ctx.end_msg(ctx.env.NTPSEC_REVISION)
 
         ctx.start_msg("Building version")



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/d4b39117c2d454a81bdc1225e5b775228ed0933f...09ffc3463383cc4f54610bad05289ab19b4087e7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161127/da05709c/attachment.html>


More information about the vc mailing list