josiahcarlson / mprop

Module properties for Python
GNU Lesser General Public License v2.1
24 stars 0 forks source link

All function defined within a module using mproperty get the module argument #1

Closed amaeldoe closed 5 years ago

amaeldoe commented 9 years ago

Hi,

All function, not just the one marked with the mproperty decorator, get a module argument. As a result:

* test.py *

from mprop import mproperty

@mproperty
def TEST(mod):
        return "TEST"

def my_func():
        return "my_func"

Python 2.7.10 (default, May 27 2015, 18:11:38) [GCC 5.1.1 20150422 (Red Hat 5.1.1-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import test test.TEST 'TEST' test.my_func() Traceback (most recent call last): File "", line 1, in TypeError: my_func() takes no arguments (1 given)

rominf commented 5 years ago

I have the same problem. The same applies to:

import mprop; mprop.init()

This makes package unusable.

@josiahcarlson, can you fix this?

josiahcarlson commented 5 years ago

Holy crap, sorry, didn't see this bug report until now. Otherwise I'd have fixed it. Will try to fix this weekend.

josiahcarlson commented 5 years ago

This should be fixed in the master branch, as well as in pypi mprop==0.15.0 .

Thank you for the bug report @amaeldoe and reminder @rominf !