[issue24912] The type of cached objects is mutable
Benjamin Peterson added the comment: Probably the patch on that bug should be reverted. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24912 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)
Changes by Alecsandru Patrascu alecsandru.patra...@intel.com: Added file: http://bugs.python.org/file40299/README2.7-pgo-v01.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24915 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)
Changes by Alecsandru Patrascu alecsandru.patra...@intel.com: Added file: http://bugs.python.org/file40300/README3.6-pgo-v01.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24915 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)
Alecsandru Patrascu added the comment: That's a good point Skip. I added another set of patches, just for the README files, explaining the entire procedure, so now anyone reading it will see that PGO is available, what are the steps involved and a brief comment about the warning. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24915 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5319] stdout error at interpreter shutdown fails to return OS error status
Martin Panter added the comment: Maybe 255 is a reasonable choice. Another option is some value slightly less than 126, since Posix shells have special meanings for 126, 127, and 128 values. My patches already document the exit status used under the Py_Exit() function: “If :c:func:`Py_FinalizeEx` indicates an error, the exit status is set to 1 [or 255].” Do you think it should be documented somewhere else as well, perhaps for the interpreter as a whole? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5319 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24958] Segfault in REPL after pressing r and PgUp twice (on Mageia Linux x86-64 6)
Shlomi Fish added the comment: Marting Panter: I'm getting the same problem with a completely empty ~/.python_history file. Moreover, I was able to reproduce a similar bug in gdb. I'll try seeing if I can create a minimal GNU readline-using program here that reproduces it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24958 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24912] The type of cached objects is mutable
Nathaniel Smith added the comment: Python goes to great lengths to make __class__ assignment work in general (I was surprised too). Historically the exception has been that instances of statically allocated C extension type objects could not have their __class__ reassigned. Semantically, this is totally arbitrary, and Guido even suggested that fixing this would be a good idea in this thread: https://mail.python.org/pipermail/python-dev/2014-December/137430.html The actual rule that's causing problems here is that *immutable* objects should not allow __class__ reassignment. (And specifically, objects which are assumed to be immutable by the interpreter. Most semantically immutable types in Python are defined by users and their immutability falls under the consenting adults rule; it's not enforced by the interpreter. Also this is very different from hashable -- even immutability isn't a requirement for being hashable, e.g., all user-defined types are mutable and hashable by default!) By accident this category of immutable-by-interpreter-invariant has tended to be a subset of defined in C using the old class definition API, so fixing the one issue uncovered the other. This goal that motivated this patch was getting __class__ assignment to work on modules, which are mutable and uncacheable and totally safe. With this patch it becomes possible to e.g. issue deprecation warnings on module attribute access, which lets us finally deprecate some horrible global constants in numpy that have been confusing users for a decade now: http://mail.scipy.org/pipermail/numpy-discussion/2015-July/073205.html https://pypi.python.org/pypi/metamodule I'd *really* prefer not to revert this totally, given the above. (Also, if you read that python-dev message above, you'll notice that the patch also caught and fixed a different really obscure interpreter-crashing bug.) I think the Correct solution would be to disallow __class__ assignment specifically for the classes where it violates invariants. If this is considered to be release critical -- and I'm not entirely sure it is, given that similar tricks have long been possible and are even referenced in the official docs? https://www.reddit.com/r/Python/comments/2441cv/can_you_change_the_value_of_1/ch3dwxt https://docs.python.org/3/c-api/long.html#c.PyLong_FromLong -- but if it is considered to be release critical, and it's considered too short notice to accomplish a proper fix, then a simple hack would be to add something like if (!(oldto-tp_flags Py_TPFLAGS_HEAPTYPE) oldto != PyModule_Type) { PyErr_Format(PyExc_TypeError, ...); return -1; } to typeobject.c:object_set_class. As compared to reverting the whole patch, this would preserve the most important case, which is one that we know is safe, and we could then progressively relax the check further in the future... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24912 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24912] The type of cached objects is mutable
Serhiy Storchaka added the comment: Later I had got a crash. class S(str): __slots__ = () ... 'a'.__class__ = S def f(a): pass ... Fatal Python error: non-string found in code slot Current thread 0xb7583700 (most recent call first): Aborted (core dumped) The stdlib is full of implicit caches. Virtually any hashable object can be cached and shared. Why __class__ assignment is allowed at all? There are only two uses of __class__ assignment in the stdlib besides tests (in Lib/importlib/util.py and in Lib/xml/sax/saxutils.py), and in both cases it looks as optimization trick. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24912 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24965] Implement PEP 498: Literal String Formatting
New submission from Eric V. Smith: See PEP 498. f'New for Python {sys.version.split()[0]}' 'New for Python 3.6.0a0' -- assignee: eric.smith components: Interpreter Core files: pep-498.diff keywords: patch messages: 249362 nosy: eric.smith priority: normal severity: normal status: open title: Implement PEP 498: Literal String Formatting type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file40302/pep-498.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24965 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24952] stack_size([size]) is actually stack_size(size=0)
mattip added the comment: Add the default value 0 to the documentation, please review this patch and not the previous one -- versions: -Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file40304/stack_size.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24952 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24963] ipaddress.IPv6Network doc typo
Roundup Robot added the comment: New changeset a892c67fa0eb by Benjamin Peterson in branch '3.4': fix spelling that was a bit confused (closes #24963) https://hg.python.org/cpython/rev/a892c67fa0eb New changeset b5434aff4e84 by Benjamin Peterson in branch '3.5': merge 3.4 (#24963) https://hg.python.org/cpython/rev/b5434aff4e84 New changeset 6463279d1358 by Benjamin Peterson in branch 'default': merge 3.5 (#24963) https://hg.python.org/cpython/rev/6463279d1358 -- nosy: +python-dev resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24963 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24965] Implement PEP 498: Literal String Formatting
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24965 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24958] Segfault in REPL after pressing r and PgUp twice (on Mageia Linux x86-64 6)
Shlomi Fish added the comment: Martin: [sorry for misspelling your name] I was now able to reproduce the same problem using rlwrap (see http://utopia.knoware.nl/~hlub/rlwrap/ ). I'll report it to the readline problem. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24958 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24912] The type of cached objects is mutable
Mark Shannon added the comment: Please revert c0d25de5919e. Breaking the interpreter in order to facilitate some obscure use case is unacceptable. If you want to do fancy stuff with modules, fine. Take a look at the source of the six module https://bitbucket.org/gutworth/six/src/cd1e81d33eaf3d6944f859c2aa7d5d3f515013c8/six.py?at=default for some tips. I think immutability is a fundamental property of an object. The consenting adults ideas is fine for accessibility. However, making previously immutable object mutable forces developers to use lots of defensive copying and causes obscure bugs (like this one). I do not regard the immutable of numbers as an historical accident, but as vitally important for any sort of numerical reasoning. Just take a look at a language with mutable strings to see the problems that causes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24912 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x
Changes by Jason R. Coombs jar...@jaraco.com: -- assignee: - jason.coombs hgrepos: +315 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12885 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12885] distutils.filelist.findall() fails on broken symlink in Py2.x
Changes by Jason R. Coombs jar...@jaraco.com: -- keywords: +patch Added file: http://bugs.python.org/file40303/faf37fc3b097.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12885 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24912] The type of cached objects is mutable
Mark Shannon added the comment: Nathaniel, I'm hostile to this patch remaining in the code base. I'm not hostile to you, sorry that I came across as that way. The proper way to deal with issues like this is to revert the change and then create a new patch, otherwise it becomes impossible to revert the change if other problems emerge. I agree that the bug in __class__ assignment should be fixed, but such a fix should be separate from adding any new features. Also, I'm surprised that you assert that you can't do what your metamodule does, without ctypes. Your metamodule package is almost there. Your statement Depending on the relative order of the assignment to sys.modules and imports of submodules, you can end up with different pieces of code in the same program thinking that mymodule refers to one or the other of these objects. is true. So, just make sure that you insert the new object into sys.modules *before* doing any imports or calls to code that could import your module and it will all work fine. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24912 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24965] Implement PEP 498: Literal String Formatting
Eric V. Smith added the comment: One thing I've done in this implementation is to build up a string to pass to str.format(), instead of using the original string. This new string uses positional parameters instead of named parameters. I had originally proposed to add a string.interpolate() to do the heavy lifting here, which would have meant I could use the original string (as seen in the source code), and not build up a new string and pass it to str.format(). I still might do that, but for now, the approach using str.format() is good enough. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24965 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24952] stack_size([size]) is actually stack_size(size=0)
mattip added the comment: Add default value of 0 to documentation for 2.7 -- versions: +Python 3.5 -Python 2.7 Added file: http://bugs.python.org/file40305/stack_size2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24952 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5319] stdout error at interpreter shutdown fails to return OS error status
Robert Collins added the comment: It seems to me that how, and when, Python exits the process is important to folk who will never ever touch the C API. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5319 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24963] ipaddress.IPv6Network doc typo
New submission from zodalahtathi: This is probably not the biggest bug ever, but in the doc for ipaddress.IPv6Network: An integer packed into a bytes object of length 16, bit-endian should be changed to: An integer packed into a bytes object of length 16, big-endian -- assignee: docs@python components: Documentation messages: 249359 nosy: docs@python, zodalahtathi priority: normal severity: normal status: open title: ipaddress.IPv6Network doc typo versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24963 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24912] The type of cached objects is mutable
Nathaniel Smith added the comment: Wow, Mark, why so hostile? What's so wrong with my proposed less-intrusive patch that you feel the need to call for reversion while condescendingly pointing me to a non-solution? Of course I know about six. There was a whole python-dev thread about how neither its tricks nor any of the other tricks that python 3.4 allows actually do what we need. Let me try again. We all agree that this bug is a bug and that numbers should be immutable. Our old rules for __class__ assignment were also buggy; it was just an accident that they were buggy in a way that happened to prevent a different bug, ie this one. The proper way to enforce the immutability of immutable builtins is to enforce the immutability of immutable builtins, not to enforce the immutability of a bunch of random types based on an implementation detail (that happens to include the immutable builtins). Reverting the patch gives us the latter, which is why I don't think it's the proper fix. Now maybe we don't have time for a proper fix. I'm not sure why not -- AFAICT there would not be any disaster if this fix waited for 3.5.1. This is a scary looking bug, but the effect is that it takes something that used to require 3 obscure lines involving ctypes and makes it into 1 obscure line not involving ctypes. Which is bad. But we're hardly going to see an epidemic of people using this loophole to change the type of 1 and then complaining to python-dev that they changed the type of 1, any more than we saw such an epidemic when ctypes was introduced. So we have time to take a deep breath and come up with a proper fix, is all I'm saying. But of course this is Larry's call. If it is crucial to get a fix in for 3.5.0, then the least intrusive solution is not to revert the patch wholesale, but rather to add a (hacky but safe) guard to object_set_class. The guard I suggested above is stricter than necessary for correctness, but it catches all the problems described in this bug report, and the cases where it's over-strict are all cases where 3.4 was also over-strict, so there's minimal chance of it causing any regressions. Like I said, I'm not sure that's what we want to do. But if it is then I can throw a patch together in a few minutes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24912 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24931] _asdict breaks when inheriting from a namedtuple
Roundup Robot added the comment: New changeset fa3ac31cfa44 by Raymond Hettinger in branch '3.4': Issue #24931: Resolve __dict__ conflict in namedtuple subclasses. https://hg.python.org/cpython/rev/fa3ac31cfa44 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24931 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24958] Segfault in REPL after pressing r and PgUp twice (on Mageia Linux x86-64 6)
Changes by R. David Murray rdmur...@bitdance.com: -- resolution: - third party stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24958 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24964] Add tunnel CONNECT response headers to httplib / http.client
Martin Panter added the comment: Such a change would involve adding a new API, so should go into a new version of Python. Thomas: a diff rather than a full copy of the changed file would be more convenient. Also, if this gets accepted, test cases and documentation would be needed. It is also useful to get the header of an unsuccessful CONNECT response. For example, see Issue 7291, where the Proxy-Authenticate header of the proxy’s 407 response needs to be accessible. In that issue, I started working on a patch tht may also be useful here. From memory, usage would be a bit like this: proxy_conn = HTTPConnection(proxy) proxy_conn.request(CONNECT, website:443) proxy_resp = proxy_conn.getresponse() if proxy_resp.status == PROXY_AUTHENTICATION_REQUIRED: # Handle proxy_resp.msg[Proxy-Authenticate] ... # Handle proxy_resp.msg[X-ProxyMesh-IP] ... tunnel = proxy_conn.detach() # Returns socket and any buffered data website_conn = HTTPSConnection(website, tunnel=tunnel) website_conn.request(GET, /) ... website_conn.close() Thomas, let me know if this would be useful for you, and I can try and dig up my patch. -- nosy: +martin.panter versions: -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24964 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24966] shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback
R. David Murray added the comment: See also issue 24920. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24966 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24966] shutil.get_terminal_size() throws ValueError is stdout is detached, no fallback
New submission from Roberto Sánchez: After the stdout stream has been overwritten and detached, the method shutils.get_terminal_size throws a ValueError exception and no fallback value is returned. Code to reproduce it: import os, sys, codecs, shutils sys.stdout = codecs.getwriter(utf-8)(sys.stdout.detach()) os.get_terminal_size() os.terminal_size(columns=160, lines=37) shutil.get_terminal_size((200, 30)) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib64/python3.4/shutil.py, line 1057, in get_terminal_size size = os.get_terminal_size(sys.__stdout__.fileno()) ValueError: underlying buffer has been detached Is this the expected behavior ? IMHO, the given fallback values should be returned. The official doc: If the terminal size cannot be successfully queried, either because the system doesn’t support querying, or because we are not connected to a terminal, the value given in fallback parameter is used. fallback defaults to (80, 24) which is the default size used by many terminal emulators BTW, the function os.get_terminal_size() returns the correct size when it's invoked without parameters, maybe It could be a good fallback if sys.__stdout__ is not available and there isn't any user fallback values. -- components: IO messages: 249372 nosy: rsc1975 priority: normal severity: normal status: open title: shutil.get_terminal_size() throws ValueError is stdout is detached, no fallback type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24966 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24966] shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback
Changes by Roberto Sánchez d...@r75.es: -- title: shutil.get_terminal_size() throws ValueError is stdout is detached, no fallback - shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24966 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23639] Not documented special names
Changes by Martin Panter vadmium...@gmail.com: -- dependencies: +__base__ undocumented stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23639 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11320] Usage of API method Py_SetPath causes errors in Py_Initialize() (Posix ony))
Palm Kevin added the comment: @ncoghlan: Not PySys_SetPath, but Py_SetPath is causing the problem (you mentionned PySys_SetPath in your message msg249311) I discovered PySys_SetPath only last Friday. In fact, in my case, the usage of PySys_SetPath (after Py_Initialize) instead of Py_SetPath (before Py_Initialize) is sufficient to respond to my needs! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11320 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com