VirtualBox

vbox的更動 59801 路徑 trunk/src/libs


忽略:
時間撮記:
2016-2-24 下午03:31:48 (9 年 以前)
作者:
vboxsync
訊息:

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

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • 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:
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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