[issue18269] Clarify which integer is required in os.chmod() exception
New submission from anatoly techtonik: (type 'int', '0755') (type 'int', '0644') Traceback (most recent call last): File ./tools/bootstrap.py, line 185, in extract_zip os.fchmod(outfile, unixperm) TypeError: an integer is required Here the integer that is required is not `unixperm`, but `outfile`. -- assignee: docs@python components: Documentation messages: 191502 nosy: docs@python, techtonik priority: normal severity: normal status: open title: Clarify which integer is required in os.chmod() exception versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18269 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Charles-François Natali added the comment: I still fail to understand why you just don't ditch the Python implementation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13483] Use VirtualAlloc to allocate memory arenas
Antoine Pitrou added the comment: I plan to test the Low Fragmentation Allocator, at least on Windows 7. I don't think it can be any better than raw mmap() / VirtualAlloc()... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13483 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18250] In itertools.repeat() object shadows object()
Antoine Pitrou added the comment: I don't think this is a problem, since it is only a local variable in a function. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18250 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13483] Use VirtualAlloc to allocate memory arenas
STINNER Victor added the comment: I plan to test the Low Fragmentation Allocator, at least on Windows 7. I don't think it can be any better than raw mmap() / VirtualAlloc()... I mean using the Low Fragmentation Allocator for PyObject_Malloc() instead of pymalloc. Martin wrote (msg148605): As an alternative approach, Python could consider completely dropping obmalloc on Windows, and using a Windows Low Fragementation Heap (LFH) instead, with HEAP_NO_SERIALIZE (as the heap would be protected by the GIL). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13483 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13483] Use VirtualAlloc to allocate memory arenas
Martin v. Löwis added the comment: Ok, I'm going to commit this patch. Any further revisions (including reversions) can be done then. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13483 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3329] API for setting the memory allocator used by Python
STINNER Victor added the comment: Update patch according to the last version of the PEP. -- Added file: http://bugs.python.org/file30653/py_setallocators-8.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3329 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18231] What's new in Python should explain what's new in UCD
Martin v. Löwis added the comment: I don't think anything of this is worth mentioning, except to mention the precise version number of the database. Anybody interested in the consequences of the change should read the announcement of the Unicode Consortium. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18231 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18234] Unicodedata module should provide access to codepoint aliases
Martin v. Löwis added the comment: I think the best way would be to provide a function unicodedata.aliases, returning a list of names for a given character or sequence. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18234 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4153] Unicode HOWTO up to date?
Roundup Robot added the comment: New changeset 1dbbed06a163 by Andrew Kuchling in branch '3.3': #4153: update Unicode howto for Python 3.3 http://hg.python.org/cpython/rev/1dbbed06a163 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4153 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16507] Patch selectmodule.c to support WSAPoll on Windows
Changes by Richard Oudkerk shibt...@gmail.com: -- keywords: +gsoc -patch resolution: - rejected stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16507 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16499] CLI option for isolated mode
Barry A. Warsaw added the comment: It applies cleanly, builds without noticeable problems and does what it's advertised to do. In other words, looks great to me! I say go for it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16499 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4153] Unicode HOWTO up to date?
A.M. Kuchling added the comment: As far as I can tell, there are no other outstanding suggestions for howto updates, so I'll now close this item. Feel free to re-open or file a new item if there are further improvements that can be made. -- resolution: - fixed stage: commit review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4153 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9122] Problems with multiprocessing, Python embedding and Windows
Richard Oudkerk added the comment: We don't do non-security updates on Python 2.6 anymore. As a workaround you might be able to do something like import sys, multiprocessing sys.frozen = True# or multiprocessing.forking.WINEXE = True ... if __name__ == '__main__': multiprocessing.freeze_support() ... (I am not familiar with using Cython.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9122 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16499] CLI option for isolated mode
STINNER Victor added the comment: python -I and spython sound like two ways to get the same results. I would prefer to only have one way. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16499 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16499] CLI option for isolated mode
Barry A. Warsaw added the comment: On Jun 20, 2013, at 02:26 PM, STINNER Victor wrote: python -I and spython sound like two ways to get the same results. I would prefer to only have one way. Where does spython come from? Personally, I'd much rather this be an option on the existing python executable (i.e. `python -I`) than some other command. That makes it easier to discover and promote. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16499 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16499] CLI option for isolated mode
Christian Heimes added the comment: We don't have spython yet. Py_IsolatedFlag is also required if we ever going to have spython, too. We can always remove the command line flag before Python 3.4 hits beta. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16499 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18270] AttributeError: 'NoneType' object has no attribute 'interp'
New submission from Dennis Backhaus: It just worked fine yesterday, but when I start IDLE (with and without trying to open a file at the same time) I get this error. Traceback (most recent call last): File /Library/Frameworks/Python.framework/Versions/2.7/bin/idle, line 5, in module main() File /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/PyShell.py, line 1560, in main shell.interp.runcommand(''.join((print(', tkversionwarning, ' AttributeError: 'NoneType' object has no attribute 'interp' -- components: IDLE messages: 191518 nosy: dbackhaus priority: normal severity: normal status: open title: AttributeError: 'NoneType' object has no attribute 'interp' versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18270 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6461] multiprocessing: freezing apps on Windows
Richard Oudkerk added the comment: I just tried freezing the program from multiprocessing import freeze_support,Manager if __name__ == '__main__': freeze_support() m=Manager() l = m.list([1,2,3]) l.append(4) print(l) print(repr(l)) using cx_Freeze with Python 2.7, and it worked fine: PS cxfreeze.bat foo.py copying C:\Python27\lib\site-packages\cx_Freeze\bases\Console.exe - C:\Tmp\dir\dist\foo.exe copying C:\Windows\system32\python27.dll - C:\Tmp\dir\dist\python27.dll writing zip file C:\Tmp\dir\dist\foo.exe ... PS dist\foo [1, 2, 3, 4] ListProxy object, typeid 'list' at 0x206f410 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11390] doctest: add cmdline parameters
R. David Murray added the comment: Here is a patch that implements the ones I'm interested in (-o for any option, and -f as a shortcut for -o FAIL_FAST). It's a good question whether doctest should support other unittest options, but doing so is more complicated than supporting -o and -f. Adding a couple people to nosy who have an interest in testing and doctest, hoping for a patch review :) -- keywords: +patch nosy: +barry, ezio.melotti, r.david.murray stage: needs patch - patch review versions: +Python 3.4 -Python 3.3 Added file: http://bugs.python.org/file30654/doctest_cli.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11390 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11390] doctest: add cmdline parameters
R. David Murray added the comment: Oh, a documentation update is still needed here, so I guess I'm not really ready for review yet :( -- stage: patch review - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11390 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16499] CLI option for isolated mode
Christian Heimes added the comment: It comes from Nick and http://www.python.org/dev/peps/pep-0432/ . Once PEP 432 is in place we can easily create variants of Python binaries with special flags. I'm in favor with python -I, too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16499 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18269] Clarify which integer is required in os.chmod() exception
Brett Cannon added the comment: os.chmod is implemented in posixmodule.c and the argument parsing code can be found at http://hg.python.org/cpython/file/3acbb23c73bc/Modules/posixmodule.c#l2605 . You will notice that the argument parsing is specified as Oi|$Op. That means the first argument is parsed as a Python object which is passed through a converter function and the second argument is required to be an integer. That converter function can be found at http://hg.python.org/cpython/file/3acbb23c73bc/Modules/posixmodule.c#l681. Looking at that code doesn't suggest that TypeError is raised with that message. What were the exact arguments you passed into os.chmod() that triggered the exception? -- assignee: docs@python - components: +Library (Lib) -Documentation nosy: +brett.cannon status: open - pending versions: -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18269 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18270] AttributeError: 'NoneType' object has no attribute 'interp'
Amaury Forgeot d'Arc added the comment: PyShell.py, line 1541: if shell and cmd or script: Does it need parentheses? if shell and (cmd or script): -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18270 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17018] Inconsistent behaviour of methods waiting for child process
Changes by Richard Oudkerk shibt...@gmail.com: -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17018 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16499] CLI option for isolated mode
Nick Coghlan added the comment: CPython's startup sequence and collection of global flags are organically evolved madness, so I think adding even more complexity to them is a bad idea. When you're in a hole, the first thing to do is *stop digging*. I could use help laying the foundations for PEP 432 though - getting the separate Programs directory split out, breaking up the monstrosity that is pythonrun.c, etc. Implementing that basic refactoring in default will make it more feasible to keep the PEP branch up to date without major conflicts. On 21 Jun 2013 00:40, Christian Heimes rep...@bugs.python.org wrote: Christian Heimes added the comment: It comes from Nick and http://www.python.org/dev/peps/pep-0432/ . Once PEP 432 is in place we can easily create variants of Python binaries with special flags. I'm in favor with python -I, too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16499 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16499 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18271] get_payload method returns bytes which cannot be decoded using the message's charset
New submission from Marko Lalic: When the message's Content-Transfer-Encoding is set to 8bit, the get_payload(decode=True) method returns the payload encoded using raw-unicode-escape. This means that it is impossible to decode the returned bytes using the content charset obtained by the get_content_charset method. It seems this should be fixed so that get_payload returns the bytes as found in the payload when Content-Transfer-Encoding is 8bit, exactly like Python2.7 handles it. from email import message_from_string message = message_from_string(MIME-Version: 1.0 ... Content-Type: text/plain; charset=utf-8 ... Content-Disposition: inline ... Content-Transfer-Encoding: 8bit ... ... ünicöde data..) message.get_content_charset() 'utf-8' message.get_payload(decode=True) b'\xfcnic\xf6de data..' message.get_payload(decode=True).decode(message.get_content_charset()) Traceback (most recent call last): File stdin, line 1, in module UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 0: invalid start byte message.get_payload(decode=True).decode('raw-unicode-escape') 'ünicöde data..' -- components: email messages: 191526 nosy: barry, mlalic, r.david.murray priority: normal severity: normal status: open title: get_payload method returns bytes which cannot be decoded using the message's charset type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18271 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18122] RuntimeError: not holding the import lock
Richard Oudkerk added the comment: See also #9573 and #15914. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18122 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11390] doctest: add cmdline parameters
Changes by R. David Murray rdmur...@bitdance.com: Removed file: http://bugs.python.org/file30654/doctest_cli.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11390 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11390] doctest: add cmdline parameters
R. David Murray added the comment: Patch updated with documentation. -- stage: needs patch - patch review Added file: http://bugs.python.org/file30655/doctest_cli.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11390 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15198] multiprocessing Pipe send of non-picklable objects doesn't raise error
Changes by Richard Oudkerk shibt...@gmail.com: -- resolution: - works for me stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15198 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18269] Clarify which integer is required in os.chmod() exception
anatoly techtonik added the comment: v = open(VERSION) import os os.fchmod(v, 0664) Traceback (most recent call last): File stdin, line 1, in module TypeError: an integer is required -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18269 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18272] In itertools recipes there is a typo in __builtins__
New submission from py.user: http://docs.python.org/3/library/itertools.html#itertools-recipes Like __builtin__.iter(func, sentinel) -- assignee: docs@python components: Documentation files: issue.diff keywords: patch messages: 191530 nosy: docs@python, py.user priority: normal severity: normal status: open title: In itertools recipes there is a typo in __builtins__ type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file30656/issue.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18272 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18272] In itertools recipes there is a typo in __builtins__
Zachary Ware added the comment: Being Python 3, it should actually be builtins rather than __builtins__. Also, imp.rst and importlib.rst have the same issue in the description of reload(). -- nosy: +zach.ware ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18272 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18272] In itertools recipes there is a typo in __builtins__
Changes by Zachary Ware zachary.w...@gmail.com: -- versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18272 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18270] AttributeError: 'NoneType' object has no attribute 'interp'
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +kbk, roger.serwy, terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18270 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18271] get_payload method returns bytes which cannot be decoded using the message's charset
Serhiy Storchaka added the comment: message.get_payload(decode=True).decode('latin1') 'ünicöde data..' -- nosy: +serhiy.storchaka versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18271 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18269] Clarify which integer is required in os.chmod() exception
Brett Cannon added the comment: That's expected with that kind of argument. os.fchmod() and os.chmod() only accept a path as a string or a file descriptor as an integer as specified in the docs: http://docs.python.org/3/library/os.html#os.chmod -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18269 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18271] get_payload method returns bytes which cannot be decoded using the message's charset
Marko Lalic added the comment: That will work fine as long as the characters are actually latin. We cannot forget the rest of the unicode character planes. Consider:: message = message_from_string(MIME-Version: 1.0 ... Content-Type: text/plain; charset=utf-8 ... Content-Disposition: inline ... Content-Transfer-Encoding: 8bit ... ... 한글ᥡ╥ສए) message.get_payload(decode=True).decode('latin1') '\\ud55c\\uae00\\u1961\\u2565\\u0eaa\\u090f' message.get_payload(decode=True).decode('raw-unicode-escape') '한글ᥡ╥ສए' However, even if latin1 did work, the main point is that a different encoding than the one the message specifies must be used in order to decode the bytes to a unicode string. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18271 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18244] singledispatch: When virtual-inheriting ABCs at distinct points in MRO, composed MRO is dependent on haystack ordering
Łukasz Langa added the comment: I meditated on the nature of the problem. A big issue that Edward pointed out is that at times the computed MRO depends on haystack ordering. We should fix that. However, my conclusion is that whatever home-grown algorithm we come up with, it will still be unintuitive for the end user. We should rather adopt C3 linearisation, which Python uses for calculating the method resolution order. Unfortunately, it doesn't specify what to do with virtual bases (either registered or implied). To solve that we need to extend the algorithm to insert the virtual bases in a correct place. We have two issues here: 1. How can we determine where this correct place is? 2. How can we determine which order unrelated abstract classes should be put in? The correct place for a virtual base class to appear in the MRO is on the level where the functionality it describes first appears. For example: from collections import * class A(object): pass ... class B(A): ... def __len__(self): ... return 0 # implies Sized ... @Container.register ... class C(object): pass ... class D(object): pass # unrelated ... class X(D, C, B): ... def __call__(self): ... return 0 # implies Callable ... If we calculate the C3 MRO for strict bases only, we get the obvious: from functools import _c3_mro _c3_mro(X) [class '__main__.X', class '__main__.D', class '__main__.C', class '__main__.B', class '__main__.A', class 'object'] If we want to insert related abstract base classes, they consistently appear right after the class where functionality has been added (note that the order of the `abcs` here doesn't matter): _c3_mro(X, abcs=[Sized, Callable, Container]) [class '__main__.X', class 'collections.abc.Callable', class '__main__.D', class '__main__.C', class 'collections.abc.Container', class '__main__.B', class 'collections.abc.Sized', class '__main__.A', class 'object'] This linearisation might be somewhat surprising but I believe it's the correct way. In fact it's only surprising because it exposes ambiguous dispatch when a class virtually subclasses multiple ABCs. For example, having a simple generic function: from functools import singledispatch from collections import * @singledispatch ... def f(arg): ... return base ... f.register(Iterable, lambda arg: iterable) f.register(Sized, lambda arg: sized) f.register(Set, lambda arg: set) this class evaluates reasonably: class C(Sized): ... def __len__(self): ... return 0 ... f(C()) 'sized' However, when we register it for another ABC, there has to be a conflict: Iterable.register(C) class '__main__.C' f(C()) Traceback (most recent call last): ... RuntimeError: Ambiguous dispatch: class 'collections.abc.Iterable' or class 'collections.abc.Sized' It doesn't matter that Sized appears explicitly in the MRO. Class C is-a Sized just as well as it is-a Iterable. However, if we also register it to be a Set as well (which subclasses both Iterable and Sized), this solves the conflict: Set.register(C) class '__main__.C' f(C()) 'set' Same goes for the case described in PEP 443 where both ABCs appear explicitly in the MRO. No conflict here becase MRO orders both bases unambiguously: class D(Sized, Iterable): ... def __len__(self): ... return 0 ... def __iter__(self): ... return iter([]) ... f(D()) 'sized' The answer to the second question (How can we determine in which order to put unrelated abstract classes?) is that we can't in general. There's fortunately a common special case that can help here: ABCs often have subclasses which are also bases of the type we're building the MRO for. For example: when inserting Iterable and Sized to the MRO of dict we can derive the correct order from the fact that both Iterable and Sized have a subclass called Mapping which also happens to be a base of dict. This trick cannot be used to fix every case but it's good enough to handle many. Summing up, the new algorithm is an extension of C3, which makes it much more predictable in edge cases. ABCs are introduced in a way that is much more deterministic (and when it depends on haystack ordering it always ends up as a RuntimeError anyway). My only real gripe with the new algorithm is that it's much larger codewise. On the other hand the ABC-aware C3 implementation could be useful for other purposes as well. Nick, Guido, this needs a serious review. Took me a while to get it right. -- Added file: http://bugs.python.org/file30657/issue18244.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18244 ___ ___ Python-bugs-list mailing list Unsubscribe:
[issue18271] get_payload method returns bytes which cannot be decoded using the message's charset
R. David Murray added the comment: The python3 email package's handling of 8bit definitely has quirks. (So did the python2 email package's, but they were different quirks. :) You can't correctly handle 8bit unless you use message_from_bytes and take the input from a byte string. It is a good question what should be done with a unicode string that claims its payload is 8bit...since that situation can't arise on the wire (or in a disk file), perhaps it should produce an exception (message must be parsed as binary data?) The problem with that idea is that the email parser promises to never raise errors, but always produce *some* sort of model from the input, possibly with defects attached. All that aside, here is what you want to be doing: from email import message_from_bytes message = message_from_bytes(bMIME-Version: 1.0 ... Content-Type: text/plain; charset=utf-8 ... Content-Disposition: inline ... Content-Transfer-Encoding: 8bit ... ... \xc3\xbcnic\xc3\xb6de data..) message.get_content_charset() 'utf-8' message.get_payload(decode=True) b'\xc3\xbcnic\xc3\xb6de data..' message.get_payload(decode=True).decode('utf-8') 'ünicöde data..' message.get_payload() 'ünicöde data..' You will note that get_payload without the decode automatically does the charset decode. I know this is counter-intuitive, but we are dealing with a legacy API that I had to retrofit. Think of decode=True as produce binary from the wire content transfer encoding, and decode=False as produce the string representation of the payload. For ASCII content-transfer-encodings, this is more intuitive (the raw quoted printable, for example), but for 8bit we can only produce a python string if we do the unicode decode...so that's what we do. You will also note that the payload in this case really *is* utf-8, whereas in your example it was unicode...and what the python3 email package does with a unicode payload is not well defined and is definitely buggy. I'm going to close this issue, because dealing with the vagaries of 8bit with string input is on my master list of things to tackle this summer, and will be dealt with in the context of other changes. -- resolution: - invalid stage: - committed/rejected status: open - closed versions: -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18271 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18273] Simplify calling and discovery of json test package
New submission from Zachary Ware: Technically, test discovery already works for test_json.py / json_tests, but not the way really expected (each test file is discovered individually), and not as simply as it could. The attached patch does the following: - remove test_json.py - rename json_tests to test_json (to match all other tests, following the example of test_email and test_importlib) - remove main() and 'if __name__ == __main__' stanza from __init__.py - rename test_suite() to load_tests(*args) - Add test_json/__main__.py, which calls unittest.main I believe this is the simplest, cleanest way to convert the json tests from test_main to unittest.main(). The patch is against 3.3; there are changes in 3.4 that make a patch against it not apply to 3.3. It merges forward easily, though. -- components: Tests files: test_json_discovery-3.3.diff keywords: patch messages: 191537 nosy: brett.cannon, ezio.melotti, zach.ware priority: normal severity: normal status: open title: Simplify calling and discovery of json test package type: enhancement versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file30658/test_json_discovery-3.3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18273 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18234] Unicodedata module should provide access to codepoint aliases
Alexander Belopolsky added the comment: UCD provides more than just a list of aliases: formal name aliases have type - control, abbreviation, etc. See http://www.unicode.org/Public/UNIDATA/NameAliases.txt. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18234 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18270] IDLE on OS X fails with Attribute Error if no initial shell and Tk out-of-date
Ned Deily added the comment: The problem here occurs when IDLE on OS X is launched without an initial shell window, either by setting the option in IDLE preferences or from the command line (/usr/local/bin/idle -e) *and* IDLE detects that the version of Tk in use is one of the suspect OS X versions and is attempting to warn the user with this message in the shell window: WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. Visit http://www.python.org/download/mac/tcltk/ for current information. Unfortunately, that doesn't work if there is no shell window. The workaround is to follow the instructions at the above link and, if possible, install an up-to-date Tcl/Tk 8.5 from ActiveState. If that is not possible, then launch IDLE from the command line with an initial shell window: /usr/local/bin/idle2.7 -i and be sure to change the preference to always launch with a shell window. -- assignee: - ned.deily nosy: +ned.deily stage: - needs patch title: AttributeError: 'NoneType' object has no attribute 'interp' - IDLE on OS X fails with Attribute Error if no initial shell and Tk out-of-date versions: +Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18270 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18271] get_payload method returns bytes which cannot be decoded using the message's charset
Marko Lalic added the comment: Thank you for your reply. Unfortunately, I have a use case where message_from_bytes has a pretty great disadvantage. I have to parse the received message and then forward it completely unchanged, apart from possibly adding a few new headers. The problem with message_from_bytes is that it changes the Content-Transfer-Encoding header to base64 (and consequently base64 encodes the content). Do you possibly have a suggestion how to currently go about solving this problem? A possible solution I can spot from your answer is to check the Content-Transfer-Encoding before getting the payload and use the version without decode=True when it is 8bit. Maybe there is something more elegant? Thank you in advance. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18271 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18269] Clarify which integer is required in os.chmod() exception
anatoly techtonik added the comment: Right. This report is about improving error message. It doesn't say what is expected where. If you have a call like: os.fchmod(outfile, unixperm) it is easy to assume that unixperm is not integer, while in fact the problem is in outfile. This could not be actual for Python 3, but it seems that there is bug with it as well. v = open(VERSION) import os os.fchmod(v, 0664) File stdin, line 1 os.fchmod(v, 0664) ^ SyntaxError: invalid token -- assignee: - docs@python components: +Documentation resolution: invalid - status: closed - open versions: +Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18269 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18271] get_payload method returns bytes which cannot be decoded using the message's charset
R. David Murray added the comment: If all you are changing is headers (and you con't change the CTE), then when you use BytesGenerator to re-serialize the message, it is supposed to preserve the existing CTE/payload. (Whether or not you call get_payload, regardless of arguments, does not matter; get_payload does not modify the Message object...though set_payload does, of course). If you have a case where the payload is being re-encoded even though you have not changed the content-type or content-transfer-encoding headers or the payload, then that is a bug. Of course, if you use just Generator (which is what str uses), the output message must be in ASCII, so in that case it does indeed transcode 8bit payloads to base64. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18271 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18269] Add new parameter format for converter function w/ position number
Brett Cannon added the comment: That is not a documentation bug (i.e. a problem with what is written at docs.python.org), this is a feature request to try to improve the exception message. That would require adding a new parameter format (http://docs.python.org/3/c-api/arg.html?highlight=pyarg_parse#other-objects) which allows for a converter function which also takes the positional number and/or keyword argument that the converter function was called for. -- assignee: docs@python - components: +Interpreter Core -Documentation, Library (Lib) priority: normal - low title: Clarify which integer is required in os.chmod() exception - Add new parameter format for converter function w/ position number type: - enhancement versions: -Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18269 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18272] In itertools recipes there is a typo in __builtins__
Changes by STINNER Victor victor.stin...@gmail.com: -- keywords: +easy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18272 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18270] IDLE on OS X fails with Attribute Error if no initial shell and Tk out-of-date
Terry J. Reedy added the comment: In 2.7.5, the offending line is 1558, not 1560. It is clearer to me as shell.interp.runcommand(print('%s') % tkversionwarning) Amaury is correct about 1541, as seen in the if block itself, but I thing the shell test should be elevated to guard all the shell-dependend actions, not just this one. See below. To me, the problem in the cracked code and convoluted code is this: If enable_shell (1520), call open_shell to set both flist.shell and shell but return if shell is None. But then at 1532, shell is set to flist.shell, and that can only have effect if not enable_shell (as otherwise shell *is* flist.shell due to return if None). In this case I expect flist.shell will always be None (its backup default as 292). But anyway, 1532 should be at least become an else: block for 1520. The following lines up to 1558 all depend on shell not being None, but only one block is guarded. So I think they should all be guarded with one 'if shell:' and 'shell removed from 1541 2.7 patch attached. 3.3 code looks identical in this area, so it should have same problem and patch should apply to that also. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18270 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18274] python: not found
New submission from William Moreno: mklib: Making FreeBSD static library: librtasm.a gmake[4]: Leaving directory `/usr/ports/graphics/libGL/work/Mesa-7.6.1/src/gallium/auxiliary/rtasm' gmake[4]: Entering directory `/usr/ports/graphics/libGL/work/Mesa-7.6.1/src/gallium/auxiliary/util' python u_format_access.py u_format.csv u_format_access.c python u_format_table.py u_format.csv u_format_table.c python: not found python: not found gmake[4]: *** No rule to make target `u_format_access.c', needed by `depend'. Stop. gmake[4]: Leaving directory `/usr/ports/graphics/libGL/work/Mesa-7.6.1/src/gallium/auxiliary/util' gmake[3]: *** [default] Error 1 gmake[3]: Leaving directory `/usr/ports/graphics/libGL/work/Mesa-7.6.1/src/gallium/auxiliary' gmake[2]: *** [default] Error 1 gmake[2]: Leaving directory `/usr/ports/graphics/libGL/work/Mesa-7.6.1/src/gallium' gmake[1]: *** [subdirs] Error 1 gmake[1]: Leaving directory `/usr/ports/graphics/libGL/work/Mesa-7.6.1/src' gmake: *** [default] Error 1 *** [do-build] Error code 1 Stop in /usr/ports/graphics/libGL. -- components: Build messages: 191545 nosy: wmoreno3 priority: normal severity: normal status: open title: python: not found type: compile error versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18274 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17630] Create a pure Python zipfile importer
Brett Cannon added the comment: Here is an initial stab at a zip file importer using importlib. Probably the biggest shortcoming is that it doesn't support bytecode files, but that's because I just have not bothered to add support yet (it's just one method to implement). There is a note in zipimport that the resolution does not match up between zip file modification times and what bytecode files store and so there needs to be a one second fuzzing factor but I'm not seeing why based on the fact that os.stat().st_mtime is used by bytecode files which has a one second resolution already like zip files. The other shortcoming is bytecode-only files are not supported (on purpose as importlib.abc.SourceLoader doesn't support bytecode-only files). -- keywords: +patch Added file: http://bugs.python.org/file30659/zip_importlib.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17630 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18272] In itertools recipes there is a typo in __builtins__
Roundup Robot added the comment: New changeset b805506b11e0 by Andrew Kuchling in branch '3.3': Closes #18272: use 'builtins' for 3.3 instead of __builtin__ http://hg.python.org/cpython/rev/b805506b11e0 -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18272 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18272] In itertools recipes there is a typo in __builtins__
A.M. Kuchling added the comment: Thanks for your report! I've corrected the error on the 3.3 and 3.4 branches. -- nosy: +akuchling ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18272 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18250] In itertools.repeat() object shadows object()
A.M. Kuchling added the comment: Thanks for your bug report and patch, but I agree that we can't change this. The repeat() function really does take 'object' as the keyword argument: from itertools import * list(repeat(times=3, object='abc')) ['abc', 'abc', 'abc'] repeat(times=3, element='abc') Traceback (most recent call last): File stdin, line 1, in module TypeError: Required argument 'object' (pos 1) not found Using 'object' is a minor wart, but I think it's not worth the backward compatibility risk of changing it. So the documentation needs to describe the actual keyword argument. -- nosy: +akuchling resolution: - wont fix stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18250 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18275] Make isinstance() work with super type instances
New submission from Brett Cannon: class A: pass class B(A): pass sup = super(B, B()) isinstance(sup, A) # returns False Why is that? Is there an explicit reason to prevent that isinstance check from working? How about just for ABCs? Either way it's annoying that at least for ABCs you can't check against a super object. -- components: Interpreter Core messages: 191550 nosy: brett.cannon priority: normal severity: normal stage: test needed status: open title: Make isinstance() work with super type instances type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18275 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17621] Create a lazy import loader mixin
Brett Cannon added the comment: One problem with the importers code is it doesn't properly clean up after the module if the load failed and it wasn't a reload. Should store an attribute on the module signaling whether it was a reload or not to know whether an exception raised during loading should lead to the module being removed from sys.modules. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18267] xmlrpc.client documentation multicall example missleading for division behaviour of python3
Roundup Robot added the comment: New changeset 2a3bc6eb2e13 by Andrew Kuchling in branch '3.3': Closes #18267: use floor division in code example http://hg.python.org/cpython/rev/2a3bc6eb2e13 -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18267 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18274] python: not found
Brett Cannon added the comment: This is not the right place to ask for help with this. This is either a FreeBSD or Mesa issue. Have you tried installing Python using FreeBSD-ports? -- nosy: +brett.cannon resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18274 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17630] Create a pure Python zipfile importer
Brett Cannon added the comment: I went ahead and added the needed method for bytecode loading; see the new patch. -- Added file: http://bugs.python.org/file30660/zip_importlib.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17630 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18274] python: not found
William Moreno added the comment: Hi ... tks for answer me What is the right place ? Yes, I have installed Python using FreeBSD-ports? I am using FreeBSD-ports regulary. William Elasio Moreno Albarracin Ingeniero de Sistemas de la Universidad Antonio Nariño Universidad Industrial de Santander - Cursos Especialización en Telecomunicaciones De: Brett Cannon rep...@bugs.python.org Para: wmore...@yahoo.com Enviado: Jueves, 20 de junio, 2013 8:43 P.M. Asunto: [issue18274] python: not found Brett Cannon added the comment: This is not the right place to ask for help with this. This is either a FreeBSD or Mesa issue. Have you tried installing Python using FreeBSD-ports? -- nosy: +brett.cannon resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18274 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18274 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com