feng-tao commented on a change in pull request #4974: [AIRFLOW-4057] Fix bug in stat name validation URL: https://github.com/apache/airflow/pull/4974#discussion_r268929570
########## File path: docs/plugins.rst ########## @@ -212,7 +212,7 @@ definitions in Airflow. flask_blueprints = [bp] appbuilder_views = [v_appbuilder_package] appbuilder_menu_items = [appbuilder_mitem] - stat_name_handler = stat_name_dummy_handler + stat_name_handler = staticmethod(stat_name_dummy_handler) Review comment: ```>>> def x(arg_that_should_be_str): ... return arg_that_should_be_str ... >>> class Foo: ... x = x ... >>> x_impl = Foo.x >>> type(x_impl) <type 'instancemethod'> >>> x_impl("a string") Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unbound method x() must be called with Foo instance as first argument (got str instance instead) >>> ^D tfeng@tfeng-mbp143 ~/playground/incubator-airflow (tfeng_fix_ci_race) $ python3 Python 3.7.1 (default, Nov 28 2018, 11:51:54) [Clang 10.0.0 (clang-1000.11.45.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> def x(t): ... return t ... >>> class Foo: ... x = x ... >>> x_impl = Foo.x >>> type(x_impl) <class 'function'> ``` somehow py2 treats as instance method while py3 treats it as function. Good find. This seems to be related to https://stackoverflow.com/questions/3589311/get-defining-class-of-unbound-method-object-in-python-3 (unbound method in python3 is gone) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services