Filters:
Languages
Toughness
Just bugs labeled...
-
· link
To reproduce, try the following code: from argparse import ArgumentParser a = ArgumentParser() a.add_argument("foo-bar") args = a.parse_args(["biz"]) print args, args.foo_bar Expected output: Namespace(foo_bar='biz') biz Actual output: Namespace(foo-bar='biz') Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'Namespace' object has no attribute 'foo_bar' Other comments: The positional argument 'foo-bar' becomes impossible to retrieve without explicitly passing keyword argument dest='foo_bar'. Hyphens in positional arguments should be automatically replaced with underscores just as with other arguments. I have not tested if this problem occurs in Python versions newer than 2.6.
-
With libpython.py loaded in gdb, when backtracing and trying to pretty-print frame objects along the way, this error is sometimes raised: Python Exception <type 'exceptions.TypeError'> object of type 'FakeRepr' has no len() See attached patch against tip.
-
· link
In many cases, PyModule_AddIntMacro() could be used instead of PyModule_AddIntConstant(), e.g. in socketmodule.c and posixmodule.c: PyModule_AddIntMacro(m, AF_INET6); vs (currently) PyModule_AddIntConstant(m, "AF_INET6", AF_INET6); It reduces the possibility of typo and is less verbose.
-
· link
The empty path '' is considered as an acceptable path in os.path.join, and works as a neutral prefix: print os.path.join('','aaa') ===> aaa which seems rather natural. But it raises an exception when used as a parameter to os.listdir. Logically, it should then list the current directory. (the alternative would be to raise an exception when os.path.join gets an empty argument). The inconsistency became clear to me when I had to write the following function : def listdirs(path,flist): # Appends to "flist" all paths to files that # start with "path". Argument "path" can be empty string ''. if path=='' : localist=os.listdir('.') else : localist=os.listdir(path) for f in localist : p=os.path.join(path,f) flist.append(p) if os.path.isdir(p) : listdirs(p,flist) return flist The conditionnal is needed only to avoid the exception, while the code is unique afterwards. This is related to Issue818059, but I did not see how that issue was resolved. Furthermore, the case of the empty path as argument to os.listdir should be documented in http://docs.python.org/2/library/os.html
-
multiprocessing.cpu_count() implementation should be made available in the os module, where it belongs.
-
In Python 3.3 (I did not test with 3.4), sys.modules cannot be reassigned without breaking the import mechanism; while it works with Python <= 3.2. Here is how to reproduce the bug: progval@Andromede:/tmp$ mkdir test_imports progval@Andromede:/tmp$ echo "from . import module" > test_imports/__init__.py progval@Andromede:/tmp$ echo "print('foo')" > test_imports/module.py progval@Andromede:/tmp$ python3.3 Python 3.3.1 (default, Apr 6 2013, 13:58:40) [GCC 4.7.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.modules = dict(sys.modules) >>> import test_imports Traceback (most recent call last): File "<stdin>", line 1, in <module> File "./test_imports/__init__.py", line 1, in <module> from . import module SystemError: Parent module 'test_imports' not loaded, cannot perform relative import >>> progval@Andromede:/tmp$ python3.2 Python 3.2.3 (default, May 6 2013, 01:46:35) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.modules = dict(sys.modules) >>> import test_imports foo >>>
-
I am in a situation where I'm building an IPNetwork from separate address and mask information. So roughly I'd like to write either: addr = IPAddress('192.168.0.0') network = IPNetwork((addr, '255.255.0.0')) or addr = '192.168.0.0' network = IPNetwork((addr, '255.255.0.0')) Of course it seems like this would be equivalent to: network = IPNetwork('%s/%s' % (addr, '255.255.0.0.')) (but more user-friendly :-))
-
Add the standard hot keys for resizing fonts (i.e. on a Mac, CMD-plus and CMD-minus).
-
· link
In 3.3 the existing PendingDeprecationWarning needs to become a DeprecationWarning. In 3.4 it will become an error. I'll change 3.3 after 3.2 is released. See issue 7994 for the original PendingDeprecationWarning discussion.
