Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1136

Report python implementation in handshake

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial - P5
    • Resolution: Fixed
    • None
    • 3.4
    • None
    • None

    Description

      PyMongo's implementation of the handshake protocol for PYTHON-1119 reports platform using sys.version. For CPython at least, sys.version doesn't report the implementation. We should prepend the implementation using platform.python_implementation:

      https://docs.python.org/2/library/platform.html#platform.python_implementation

      Examples:

      Python 2.7.12 (default, Jul 27 2016, 12:59:12) 
      [GCC 5.4.0] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import sys
      >>> sys.version
      '2.7.12 (default, Jul 27 2016, 12:59:12) \n[GCC 5.4.0]'
      >>> import platform
      >>> platform.python_implementation()
      'CPython'
       
      Python 3.4.5 (default, Jul 27 2016, 13:01:56) 
      [GCC 5.4.0] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import sys
      >>> sys.version
      '3.4.5 (default, Jul 27 2016, 13:01:56) \n[GCC 5.4.0]'
      >>> import platform
      >>> platform.python_implementation()
      'CPython'
       
      Python 2.7.3 (5acfe049a5b0cd0de158f62553a98f5ef364fd29, Jul 02 2013, 07:29:58)
      [PyPy 2.0.2 with GCC 4.7.2 20121015 (Red Hat 4.7.2-5)] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      And now for something completely different: ``PyPy is a tool to keep otherwise
      dangerous minds safely occupied.''
      >>>> import sys
      >>>> sys.version
      '2.7.3 (5acfe049a5b0cd0de158f62553a98f5ef364fd29, Jul 02 2013, 07:29:58)\n[PyPy 2.0.2 with GCC 4.7.2 20121015 (Red Hat 4.7.2-5)]'
      >>>> import platform
      >>>> platform.python_implementation()
      'PyPy' 
       
      Python 3.2.5 (b2091e973da69152b3f928bfaabd5d2347e6df46, Oct 24 2014, 12:08:04)
      [PyPy 2.4.0 with GCC 4.8.2] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>>> import sys
      >>>> sys.version
      '3.2.5 (b2091e973da69152b3f928bfaabd5d2347e6df46, Oct 24 2014, 12:08:04)\n[PyPy 2.4.0 with GCC 4.8.2]'
      >>>> import platform
      >>>> platform.python_implementation()
      'PyPy'
       
      Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) 
      [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_102
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import sys
      >>> sys.version
      '2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) \n[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]'
      >>> import platform
      >>> platform.python_implementation()
      'Jython'
      

      Attachments

        Activity

          People

            bernie@mongodb.com Bernie Hackett
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: