facebookarchive / nailgun

Nailgun is a client, protocol, and server for running Java programs from the command line without incurring the JVM startup overhead.
https://github.com/facebook/nailgun
Other
731 stars 138 forks source link

[python3] Fix memoryview to work with python3 #176

Closed nataliejameson closed 5 years ago

nataliejameson commented 5 years ago

Fix an issue with memoryview and ctypes c_char_array not working in python3. The behavior is sufficiently different in python2 and 3 that a shim memoryview function was added.

Test Plan:

Tests pass

$ mvn package
$ PYTHONPATH=nailgun-client/py python2.7 nailgun-client/py/test_ng.py
com.facebook.nailgun.builtins.NGServerStats: 1/1
........
----------------------------------------------------------------------
Ran 8 tests in 27.692s

OK
$ PYTHONPATH=nailgun-client/py python3.6 nailgun-client/py/test_ng.py
com.facebook.nailgun.builtins.NGServerStats: 1/1
........
----------------------------------------------------------------------
Ran 8 tests in 25.942s

OK
$ PYTHONPATH=nailgun-client/py python3.7 nailgun-client/py/test_ng.py
com.facebook.nailgun.builtins.NGServerStats: 1/1
........
----------------------------------------------------------------------
Ran 8 tests in 25.942s

OK
PS C:\Users\pjameson\nailgun> git checkout python3
Switched to a new branch 'python3'
Branch 'python3' set up to track remote branch 'python3' from 'origin'.
PS C:\Users\pjameson\nailgun> $env:PYTHONPATH=".\nailgun-client\py\"; python3.6 .\nailgun-client\py\test_ng.py
com.facebook.nailgun.builtins.NGServerStats: 1/1
........
----------------------------------------------------------------------
Ran 8 tests in 108.627s

OK
PS C:\Users\pjameson\nailgun> $env:PYTHONPATH=".\nailgun-client\py\"; python2.7 .\nailgun-client\py\test_ng.py
com.facebook.nailgun.builtins.NGServerStats: 1/1
........
----------------------------------------------------------------------
Ran 8 tests in 131.204s

OK