VirtualBox

Changeset 59801 in vbox


Ignore:
Timestamp:
Feb 24, 2016 3:31:48 PM (9 years ago)
Author:
vboxsync
Message:

python/server/policy.py: python two fixes: long != int, str != unicode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/python/server/policy.py

    r59798 r59801  
    4444import logging
    4545import sys
     46
     47# Python 3 hacks:
     48if sys.version_info[0] >= 3:
     49    long = int      # pylint: disable=W0622,C0103
    4650
    4751
     
    333337        return self._doHandleException(name, exc_info)
    334338
    335 _supports_primitives_data_ = [
    336     ("nsISupportsCString", "__str__", str),
    337     ("nsISupportsString", "__unicode__", str),
    338     ("nsISupportsPRUint64", "__long__", int),
    339     ("nsISupportsPRInt64", "__long__", int),
    340     ("nsISupportsPRUint32", "__int__", int),
    341     ("nsISupportsPRInt32", "__int__", int),
    342     ("nsISupportsPRUint16", "__int__", int),
    343     ("nsISupportsPRInt16", "__int__", int),
    344     ("nsISupportsPRUint8", "__int__", int),
    345     ("nsISupportsPRBool", "__nonzero__", operator.truth),
    346     ("nsISupportsDouble", "__float__", float),
    347     ("nsISupportsFloat", "__float__", float),
    348 ]
     339if sys.version_info[0] <= 2:
     340    _supports_primitives_data_ = [
     341        ("nsISupportsCString", "__str__", str),
     342        ("nsISupportsString", "__unicode__", unicode),
     343        ("nsISupportsPRUint64", "__long__", long),
     344        ("nsISupportsPRInt64", "__long__", long),
     345        ("nsISupportsPRUint32", "__int__", int),
     346        ("nsISupportsPRInt32", "__int__", int),
     347        ("nsISupportsPRUint16", "__int__", int),
     348        ("nsISupportsPRInt16", "__int__", int),
     349        ("nsISupportsPRUint8", "__int__", int),
     350        ("nsISupportsPRBool", "__nonzero__", operator.truth),
     351        ("nsISupportsDouble", "__float__", float),
     352        ("nsISupportsFloat", "__float__", float),
     353    ]
     354else:
     355    _supports_primitives_data_ = [
     356        ("nsISupportsCString", "__str__", str),
     357        ("nsISupportsString", "__unicode__", str),
     358        ("nsISupportsPRUint64", "__long__", int),
     359        ("nsISupportsPRInt64", "__long__", int),
     360        ("nsISupportsPRUint32", "__int__", int),
     361        ("nsISupportsPRInt32", "__int__", int),
     362        ("nsISupportsPRUint16", "__int__", int),
     363        ("nsISupportsPRInt16", "__int__", int),
     364        ("nsISupportsPRUint8", "__int__", int),
     365        ("nsISupportsPRBool", "__nonzero__", operator.truth),
     366        ("nsISupportsDouble", "__float__", float),
     367        ("nsISupportsFloat", "__float__", float),
     368    ]
    349369
    350370# Support for the nsISupports primitives:
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette